fix: 重构生成前注入与历史回滚链路

This commit is contained in:
Youzini-afk
2026-03-25 02:45:43 +08:00
parent 58c43d638b
commit 7bfe37e964
6 changed files with 706 additions and 132 deletions

View File

@@ -11,7 +11,7 @@ import {
/**
* 图状态版本号
*/
const GRAPH_VERSION = 4;
const GRAPH_VERSION = 5;
/**
* 生成 UUID v4
@@ -510,6 +510,20 @@ export function deserializeGraph(json) {
: createDefaultBatchJournal();
}
if (data.version < 5) {
data.historyState = {
...createDefaultHistoryState(),
...(data.historyState || {}),
extractionCount: Number.isFinite(data?.historyState?.extractionCount)
? data.historyState.extractionCount
: 0,
lastMutationSource: String(data?.historyState?.lastMutationSource || ""),
};
data.batchJournal = Array.isArray(data.batchJournal)
? data.batchJournal
: createDefaultBatchJournal();
}
data.version = GRAPH_VERSION;
}
@@ -550,6 +564,10 @@ export function deserializeGraph(json) {
)
? data.historyState.lastProcessedAssistantFloor
: data.lastProcessedSeq,
extractionCount: Number.isFinite(data?.historyState?.extractionCount)
? data.historyState.extractionCount
: 0,
lastMutationSource: String(data?.historyState?.lastMutationSource || ""),
};
data.vectorIndexState = {
...createDefaultVectorIndexState(data?.historyState?.chatId || ""),