mirror of
https://github.com/Youzini-afk/ST-Bionic-Memory-Ecology.git
synced 2026-05-15 22:30:38 +08:00
Add Authority jobs task backend
This commit is contained in:
28
ui/panel.js
28
ui/panel.js
@@ -1975,6 +1975,23 @@ function _refreshTaskPipelineOverview() {
|
||||
if (pipelinePersistDeltaMeta) {
|
||||
persistenceMetaParts.push(pipelinePersistDeltaMeta);
|
||||
}
|
||||
const authorityJob = loadInfo.authorityLastJob || {};
|
||||
const authorityJobParts = [
|
||||
authorityJob.id || loadInfo.authorityLastJobId
|
||||
? `job ${authorityJob.id || loadInfo.authorityLastJobId}`
|
||||
: "",
|
||||
authorityJob.kind || loadInfo.authorityLastJobKind || "",
|
||||
authorityJob.status || loadInfo.authorityLastJobStatus || "",
|
||||
].filter(Boolean);
|
||||
const authorityJobProgress = Number(
|
||||
authorityJob.progress ?? loadInfo.authorityLastJobProgress,
|
||||
);
|
||||
if (Number.isFinite(authorityJobProgress) && authorityJobProgress > 0) {
|
||||
authorityJobParts.push(`${Math.round(authorityJobProgress * 100)}%`);
|
||||
}
|
||||
if (loadInfo.authorityLastJobError) {
|
||||
authorityJobParts.push(`error ${loadInfo.authorityLastJobError}`);
|
||||
}
|
||||
const persistence = _resolvePipelineStatus({
|
||||
text: loadInfo.loadState || "unknown",
|
||||
meta: persistenceMetaParts.join(" · "),
|
||||
@@ -2026,7 +2043,16 @@ function _refreshTaskPipelineOverview() {
|
||||
|
||||
const statusRows = [
|
||||
{ label: "提取", color: extraction.color, value: extraction.label + (extraction.detail ? ` — ${extraction.detail}` : "") },
|
||||
{ label: "向量", color: vector.color, value: vector.label + (vector.detail ? ` — ${vector.detail}` : "") },
|
||||
{
|
||||
label: "向量",
|
||||
color: vector.color,
|
||||
value:
|
||||
vector.label +
|
||||
(vector.detail ? ` — ${vector.detail}` : "") +
|
||||
(authorityJobParts.length
|
||||
? ` · Authority ${authorityJobParts.join(" · ")}`
|
||||
: ""),
|
||||
},
|
||||
{ label: "召回", color: recall.color, value: recall.label + (recall.detail ? ` — ${recall.detail}` : "") },
|
||||
{ label: "持久化", color: persistence.color, value: persistence.label + (persistence.detail ? ` — ${persistence.detail}` : "") },
|
||||
];
|
||||
|
||||
@@ -587,6 +587,32 @@ export async function onRebuildVectorIndexController(runtime, range = null) {
|
||||
|
||||
const vectorController = runtime.beginStageAbortController("vector");
|
||||
try {
|
||||
if (
|
||||
!range &&
|
||||
typeof runtime.shouldUseAuthorityJobs === "function" &&
|
||||
runtime.shouldUseAuthorityJobs(config) &&
|
||||
typeof runtime.submitAuthorityVectorRebuildJob === "function"
|
||||
) {
|
||||
const jobResult = await runtime.submitAuthorityVectorRebuildJob({
|
||||
config,
|
||||
purge: true,
|
||||
range,
|
||||
signal: vectorController.signal,
|
||||
});
|
||||
if (jobResult?.submitted) {
|
||||
runtime.saveGraphToChat({ reason: "authority-vector-rebuild-job-submitted" });
|
||||
runtime.toastr.info(
|
||||
`Authority 向量重建任务已提交:${jobResult.job?.id || "pending"}`,
|
||||
);
|
||||
return;
|
||||
}
|
||||
if (jobResult?.error) {
|
||||
runtime.toastr.warning(
|
||||
`Authority Job 提交失败,已回退本地重建:${jobResult.error}`,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
const result = await runtime.syncVectorState({
|
||||
force: true,
|
||||
purge:
|
||||
|
||||
@@ -146,6 +146,15 @@ export function createGraphPersistenceState() {
|
||||
authorityMigrationRevision: 0,
|
||||
authorityMigrationLastError: "",
|
||||
lastAuthorityMigrationResult: null,
|
||||
authorityJobsReady: false,
|
||||
authorityJobQueueState: "idle",
|
||||
authorityLastJob: null,
|
||||
authorityLastJobId: "",
|
||||
authorityLastJobKind: "",
|
||||
authorityLastJobStatus: "",
|
||||
authorityLastJobProgress: 0,
|
||||
authorityLastJobError: "",
|
||||
authorityLastJobUpdatedAt: "",
|
||||
localStoreFormatVersion: 1,
|
||||
localStoreMigrationState: "idle",
|
||||
opfsWriteLockState: {
|
||||
|
||||
Reference in New Issue
Block a user