Improve L0 extraction flow and recall robustness

This commit is contained in:
2026-02-10 12:43:43 +08:00
parent 3af76a9651
commit 1fe0647462
5 changed files with 370 additions and 120 deletions

View File

@@ -878,16 +878,23 @@ export async function recallMemory(allEvents, vectorConfig, options = {}) {
try {
const [vec] = await embed([bundle.queryText_v0], vectorConfig, { timeout: 10000 });
queryVector_v0 = vec;
} catch (e) {
xbLog.error(MODULE_ID, 'Round 1 向量化失败', e);
metrics.timing.total = Math.round(performance.now() - T0);
return {
events: [], l0Selected: [], l1ByFloor: new Map(), causalChain: [],
focusEntities: bundle.focusEntities,
elapsed: metrics.timing.total,
logText: 'Embedding failed (round 1).',
metrics,
};
} catch (e1) {
xbLog.warn(MODULE_ID, 'Round 1 向量化失败500ms 后重试', e1);
await new Promise(r => setTimeout(r, 500));
try {
const [vec] = await embed([bundle.queryText_v0], vectorConfig, { timeout: 15000 });
queryVector_v0 = vec;
} catch (e2) {
xbLog.error(MODULE_ID, 'Round 1 向量化重试仍失败', e2);
metrics.timing.total = Math.round(performance.now() - T0);
return {
events: [], l0Selected: [], l1ByFloor: new Map(), causalChain: [],
focusEntities: bundle.focusEntities,
elapsed: metrics.timing.total,
logText: 'Embedding failed (round 1, after retry).',
metrics,
};
}
}
if (!queryVector_v0?.length) {