mirror of
https://github.com/Youzini-afk/ST-Bionic-Memory-Ecology.git
synced 2026-06-14 02:40:45 +08:00
fix: limit reroll re-extract to single latest assistant batch
This commit is contained in:
@@ -223,7 +223,7 @@ export async function runExtractionController(runtime) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function onManualExtractController(runtime) {
|
export async function onManualExtractController(runtime, options = {}) {
|
||||||
if (runtime.getIsExtracting()) {
|
if (runtime.getIsExtracting()) {
|
||||||
runtime.toastr.info("记忆提取正在进行中,请稍候");
|
runtime.toastr.info("记忆提取正在进行中,请稍候");
|
||||||
return;
|
return;
|
||||||
@@ -271,6 +271,7 @@ export async function onManualExtractController(runtime) {
|
|||||||
"手动提取中",
|
"手动提取中",
|
||||||
`待处理 assistant 楼层 ${pendingAssistantTurns.length} 条`,
|
`待处理 assistant 楼层 ${pendingAssistantTurns.length} 条`,
|
||||||
"running",
|
"running",
|
||||||
|
|
||||||
{ syncRuntime: true, toastKind: "info", toastTitle: "ST-BME 手动提取" },
|
{ syncRuntime: true, toastKind: "info", toastTitle: "ST-BME 手动提取" },
|
||||||
);
|
);
|
||||||
try {
|
try {
|
||||||
@@ -307,6 +308,10 @@ export async function onManualExtractController(runtime) {
|
|||||||
if (Array.isArray(batchResult.effects?.warnings)) {
|
if (Array.isArray(batchResult.effects?.warnings)) {
|
||||||
warnings.push(...batchResult.effects.warnings);
|
warnings.push(...batchResult.effects.warnings);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (options?.drainAll === false) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (totals.batches === 0) {
|
if (totals.batches === 0) {
|
||||||
@@ -521,7 +526,7 @@ export async function onRerollController(runtime, { fromFloor } = {}) {
|
|||||||
timeOut: 2500,
|
timeOut: 2500,
|
||||||
});
|
});
|
||||||
|
|
||||||
await runtime.onManualExtract();
|
await runtime.onManualExtract({ drainAll: false });
|
||||||
runtime.refreshPanelLiveState();
|
runtime.refreshPanelLiveState();
|
||||||
return {
|
return {
|
||||||
...rollbackResult,
|
...rollbackResult,
|
||||||
|
|||||||
4
index.js
4
index.js
@@ -5058,7 +5058,7 @@ async function onFetchEmbeddingModels(mode = null) {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
async function onManualExtract() {
|
async function onManualExtract(options = {}) {
|
||||||
return await onManualExtractController({
|
return await onManualExtractController({
|
||||||
beginStageAbortController,
|
beginStageAbortController,
|
||||||
clampInt,
|
clampInt,
|
||||||
@@ -5086,7 +5086,7 @@ async function onManualExtract() {
|
|||||||
},
|
},
|
||||||
setLastExtractionStatus,
|
setLastExtractionStatus,
|
||||||
toastr,
|
toastr,
|
||||||
});
|
}, options);
|
||||||
}
|
}
|
||||||
|
|
||||||
async function onReroll({ fromFloor } = {}) {
|
async function onReroll({ fromFloor } = {}) {
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ const vectorSnippet = extractSnippet(
|
|||||||
"async function ensureVectorReadyIfNeeded(",
|
"async function ensureVectorReadyIfNeeded(",
|
||||||
);
|
);
|
||||||
const manualExtractSnippet = extractSnippet(
|
const manualExtractSnippet = extractSnippet(
|
||||||
"async function onManualExtract() {",
|
"async function onManualExtract(options = {}) {",
|
||||||
"async function onReroll(",
|
"async function onReroll(",
|
||||||
);
|
);
|
||||||
const rebuildSnippet = extractSnippet(
|
const rebuildSnippet = extractSnippet(
|
||||||
|
|||||||
Reference in New Issue
Block a user