Improve L0 extraction flow and recall robustness
This commit is contained in:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user