mirror of
https://github.com/Youzini-afk/ST-Bionic-Memory-Ecology.git
synced 2026-05-15 22:30:38 +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()) {
|
||||
runtime.toastr.info("记忆提取正在进行中,请稍候");
|
||||
return;
|
||||
@@ -271,6 +271,7 @@ export async function onManualExtractController(runtime) {
|
||||
"手动提取中",
|
||||
`待处理 assistant 楼层 ${pendingAssistantTurns.length} 条`,
|
||||
"running",
|
||||
|
||||
{ syncRuntime: true, toastKind: "info", toastTitle: "ST-BME 手动提取" },
|
||||
);
|
||||
try {
|
||||
@@ -307,6 +308,10 @@ export async function onManualExtractController(runtime) {
|
||||
if (Array.isArray(batchResult.effects?.warnings)) {
|
||||
warnings.push(...batchResult.effects.warnings);
|
||||
}
|
||||
|
||||
if (options?.drainAll === false) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (totals.batches === 0) {
|
||||
@@ -521,7 +526,7 @@ export async function onRerollController(runtime, { fromFloor } = {}) {
|
||||
timeOut: 2500,
|
||||
});
|
||||
|
||||
await runtime.onManualExtract();
|
||||
await runtime.onManualExtract({ drainAll: false });
|
||||
runtime.refreshPanelLiveState();
|
||||
return {
|
||||
...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({
|
||||
beginStageAbortController,
|
||||
clampInt,
|
||||
@@ -5086,7 +5086,7 @@ async function onManualExtract() {
|
||||
},
|
||||
setLastExtractionStatus,
|
||||
toastr,
|
||||
});
|
||||
}, options);
|
||||
}
|
||||
|
||||
async function onReroll({ fromFloor } = {}) {
|
||||
|
||||
@@ -28,7 +28,7 @@ const vectorSnippet = extractSnippet(
|
||||
"async function ensureVectorReadyIfNeeded(",
|
||||
);
|
||||
const manualExtractSnippet = extractSnippet(
|
||||
"async function onManualExtract() {",
|
||||
"async function onManualExtract(options = {}) {",
|
||||
"async function onReroll(",
|
||||
);
|
||||
const rebuildSnippet = extractSnippet(
|
||||
|
||||
Reference in New Issue
Block a user