mirror of
https://github.com/Youzini-afk/ST-Bionic-Memory-Ecology.git
synced 2026-05-15 22:30:38 +08:00
fix: 重新提取回滚点不可用时自动执行历史恢复并降级为 pending 模式
当提取/整合被中断后手动重新提取(rerun 模式)失败时,不再显示 死胡同错误,而是自动尝试历史恢复后继续提取未处理内容。
This commit is contained in:
@@ -1262,10 +1262,65 @@ export async function onExtractionTaskController(runtime, options = {}) {
|
||||
},
|
||||
);
|
||||
|
||||
const rollbackResult = await runtime.rollbackGraphForReroll(
|
||||
let rollbackResult = await runtime.rollbackGraphForReroll(
|
||||
fallbackInfo.startAssistantChatIndex,
|
||||
context,
|
||||
);
|
||||
|
||||
// 回滚点不可用时,自动尝试历史恢复后降级为 pending 模式
|
||||
if (
|
||||
!rollbackResult?.success &&
|
||||
rollbackResult?.resultCode === "reroll.rollback.unavailable" &&
|
||||
typeof runtime.recoverHistoryIfNeeded === "function"
|
||||
) {
|
||||
setExtractionProgressStatus(
|
||||
runtime,
|
||||
"重新提取准备中",
|
||||
"未找到回滚点,正在自动执行历史恢复后重新提取",
|
||||
"running",
|
||||
{
|
||||
syncRuntime: true,
|
||||
toastKind: "info",
|
||||
toastTitle: "ST-BME 重新提取",
|
||||
},
|
||||
);
|
||||
const recovered = await runtime.recoverHistoryIfNeeded(
|
||||
"rerun-rollback-unavailable",
|
||||
);
|
||||
if (recovered) {
|
||||
// 历史恢复成功,降级为 pending 模式继续提取
|
||||
setExtractionProgressStatus(
|
||||
runtime,
|
||||
"重新提取中",
|
||||
"历史恢复完成,正在提取未处理内容",
|
||||
"running",
|
||||
{
|
||||
syncRuntime: true,
|
||||
toastKind: "",
|
||||
toastTitle: "ST-BME 重新提取",
|
||||
},
|
||||
);
|
||||
await runManualExtract({
|
||||
drainAll: true,
|
||||
taskLabel: "重新提取(恢复后)",
|
||||
toastTitle: "ST-BME 重新提取",
|
||||
showStartToast: false,
|
||||
});
|
||||
return {
|
||||
success: true,
|
||||
rerunPerformed: true,
|
||||
recoveryFallback: true,
|
||||
fallbackToLatest: true,
|
||||
requestedRange: [
|
||||
rerunTask.requestedStartFloor,
|
||||
rerunTask.requestedEndFloor,
|
||||
],
|
||||
effectiveDialogueRange,
|
||||
reason: "rollback-unavailable-recovered-pending",
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
if (!rollbackResult?.success) {
|
||||
const rollbackError = String(
|
||||
rollbackResult?.error ||
|
||||
|
||||
Reference in New Issue
Block a user