Refine memory filtering and lexicon sources for focus entities

This commit is contained in:
2026-02-13 18:54:19 +08:00
parent f7abdd8e94
commit c6c07a2104
2 changed files with 19 additions and 11 deletions

View File

@@ -826,8 +826,11 @@ async function buildVectorPrompt(store, recallResult, causalById, focusEntities,
const isDirect = e._recallType === "DIRECT";
if (!isDirect && relatedBudget.used >= relatedBudget.max) continue;
// 收集该事件范围内的 EvidenceGroupper-floor
const evidenceGroups = collectEvidenceGroupsForEvent(e.event, l0Selected, l1ByFloor, usedL0Ids);
// 硬规则RELATED 事件不挂证据(不挂 L0/L1只保留事件摘要
// DIRECT 才允许收集事件内证据组。
const evidenceGroups = isDirect
? collectEvidenceGroupsForEvent(e.event, l0Selected, l1ByFloor, usedL0Ids)
: [];
// 格式化事件(含证据)
const text = formatEventWithEvidence(e, 0, evidenceGroups, causalById);

View File

@@ -30,7 +30,8 @@ function normalize(s) {
* 1. store.json.characters.main — 已确认主要角色
* 2. store.json.arcs[].name — 弧光对象
* 3. context.name2 — 当前角色
* 4. store.json.facts[].s — L3实主语
* 4. store.json.events[].participants — L2件参与者
* 5. L0 atoms edges.s/edges.t
*
* 硬约束:永远排除 normalize(context.name1)
*
@@ -64,11 +65,12 @@ export function buildEntityLexicon(store, context) {
add(context.name2);
}
// 4. L3 facts 主语
const facts = store?.json?.facts || [];
for (const f of facts) {
if (f.retracted) continue;
add(f.s);
// 4. L2 events 参与者
const events = store?.json?.events || [];
for (const ev of events) {
for (const p of (ev?.participants || [])) {
add(p);
}
}
// 5. L0 atoms 的 edges.s/edges.t新角色在 L2 总结前即可进入词典)
@@ -118,9 +120,12 @@ export function buildDisplayNameMap(store, context) {
if (context?.name2) register(context.name2);
const facts = store?.json?.facts || [];
for (const f of facts) {
if (!f.retracted) register(f.s);
// 4. L2 events 参与者
const events = store?.json?.events || [];
for (const ev of events) {
for (const p of (ev?.participants || [])) {
register(p);
}
}
// 5. L0 atoms 的 edges.s/edges.t