Improve cross_device MemFuse recall with source tags and recallContext.

Auto-enable device/location prefixes for cross_device scenarios, thread question_device into keyword and embedding paths, and boost lexical scores from source-tag tokens.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
john
2026-09-02 14:12:48 +08:00
parent fb3a442e73
commit 6d48480b1c
4 changed files with 134 additions and 5 deletions
+7 -1
View File
@@ -450,6 +450,10 @@ export async function runMemFuseBenchCase({
query: testCase.question,
limit,
candidateLimit,
recallContext: {
device: testCase.questionDevice || null,
user: testCase.questionUser || null,
},
});
const retrieved = result.memories.map((memory) => memory.id).filter(Boolean);
@@ -548,7 +552,9 @@ export async function runMemFuseBench({
questionIds,
});
if (cases.length === 0) continue;
const corpus = buildScenarioCorpus(scenario, { includeSourceTags });
const needsSourceTags = includeSourceTags
|| cases.some((testCase) => String(testCase.dimension).startsWith('cross_device_'));
const corpus = buildScenarioCorpus(scenario, { includeSourceTags: needsSourceTags });
if (typeof prefetchEmbedTexts === 'function') {
await prefetchEmbedTexts([
...corpus.rows.map((row) => row.content),