feat(recall): add diffusion stage and improve retrieval metrics

This commit is contained in:
2026-02-12 15:36:07 +08:00
parent 111cd081f6
commit a646a70224
6 changed files with 1084 additions and 61 deletions

View File

@@ -8,6 +8,8 @@
// 硬约束name1 永不进入词典
// ═══════════════════════════════════════════════════════════════════════════
import { getStateAtoms } from '../storage/state-store.js';
/**
* 标准化字符串(用于实体匹配)
* @param {string} s
@@ -69,6 +71,14 @@ export function buildEntityLexicon(store, context) {
add(f.s);
}
// 5. L0 atoms 的 who新角色在 L2 总结前即可进入词典)
const atoms = getStateAtoms();
for (const atom of atoms) {
for (const name of (atom.who || [])) {
add(name);
}
}
// ★ 硬约束:删除 name1
if (context?.name1) {
lexicon.delete(normalize(context.name1));
@@ -112,6 +122,14 @@ export function buildDisplayNameMap(store, context) {
if (!f.retracted) register(f.s);
}
// 5. L0 atoms 的 who
const atoms = getStateAtoms();
for (const atom of atoms) {
for (const name of (atom.who || [])) {
register(name);
}
}
// ★ 硬约束:删除 name1
if (context?.name1) {
map.delete(normalize(context.name1));