mirror of
https://github.com/Youzini-afk/ST-Bionic-Memory-Ecology.git
synced 2026-05-15 22:30:38 +08:00
Fix recall rerank stability and card binding
This commit is contained in:
@@ -3532,6 +3532,70 @@ async function testPersistentRecallSourceResolutionAndTargetRouting() {
|
||||
assert.equal(fallback.injectionText, "persisted");
|
||||
}
|
||||
|
||||
async function testGenerationRecallFinalInjectionRebindsLatestMatchingUserFloor() {
|
||||
{
|
||||
const harness = await createGenerationRecallHarness({ realApplyFinal: true });
|
||||
harness.chat = [
|
||||
{ is_user: true, mes: "当前输入" },
|
||||
{ is_user: false, mes: "assistant-tail" },
|
||||
];
|
||||
harness.result.recordRecallSentUserMessage(0, "当前输入", "message-sent");
|
||||
|
||||
const resolution =
|
||||
harness.result.applyFinalRecallInjectionForGeneration({
|
||||
generationType: "normal",
|
||||
hookName: "GENERATION_AFTER_COMMANDS",
|
||||
freshRecallResult: {
|
||||
status: "completed",
|
||||
didRecall: true,
|
||||
injectionText: "fresh-memory",
|
||||
},
|
||||
transaction: {
|
||||
frozenRecallOptions: {
|
||||
generationType: "normal",
|
||||
targetUserMessageIndex: null,
|
||||
overrideUserMessage: "当前输入",
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
assert.equal(resolution.targetUserMessageIndex, 0);
|
||||
}
|
||||
|
||||
{
|
||||
const harness = await createGenerationRecallHarness({ realApplyFinal: true });
|
||||
harness.chat = [
|
||||
{ is_user: true, mes: "尾部 user 仍可匹配" },
|
||||
{ is_user: false, mes: "assistant-tail" },
|
||||
];
|
||||
|
||||
const resolution =
|
||||
harness.result.applyFinalRecallInjectionForGeneration({
|
||||
generationType: "normal",
|
||||
hookName: "GENERATION_AFTER_COMMANDS",
|
||||
freshRecallResult: {
|
||||
status: "completed",
|
||||
didRecall: true,
|
||||
injectionText: "fresh-memory",
|
||||
sourceCandidates: [
|
||||
{
|
||||
text: "尾部 user 仍可匹配",
|
||||
},
|
||||
],
|
||||
},
|
||||
transaction: {
|
||||
frozenRecallOptions: {
|
||||
generationType: "normal",
|
||||
targetUserMessageIndex: null,
|
||||
overrideUserMessage: "尾部 user 仍可匹配",
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
assert.equal(resolution.targetUserMessageIndex, 0);
|
||||
}
|
||||
}
|
||||
|
||||
async function testRecallSubGraphAndDataLayerEntryPoints() {
|
||||
// Sub-graph build test (pure function, no DOM needed)
|
||||
const { buildRecallSubGraph } = await import("../recall-message-ui.js");
|
||||
@@ -4340,6 +4404,7 @@ await testGenerationRecallAppliesFinalInjectionOncePerTransaction();
|
||||
await testGenerationRecallDeferredRewriteMutatesFinalMesSendPayload();
|
||||
await testPersistentRecallDataLayerLifecycleAndCompatibility();
|
||||
await testPersistentRecallSourceResolutionAndTargetRouting();
|
||||
await testGenerationRecallFinalInjectionRebindsLatestMatchingUserFloor();
|
||||
await testRecallCardMountsOnStandardUserMessageDom();
|
||||
await testRecallCardSkipsMountWithoutStableMessageIndex();
|
||||
await testRecallCardDelayedDomInsertionEventuallyRenders();
|
||||
|
||||
@@ -279,6 +279,8 @@ assert.equal(llmPoolResult.meta.retrieval.diversityApplied, true);
|
||||
assert.equal(llmPoolResult.meta.retrieval.candidatePoolBeforeDpp, 3);
|
||||
assert.equal(llmPoolResult.meta.retrieval.candidatePoolAfterDpp, 2);
|
||||
assert.equal(state.llmOptions[0].returnFailureDetails, true);
|
||||
assert.equal(state.llmOptions[0].maxRetries, 2);
|
||||
assert.equal(state.llmOptions[0].maxCompletionTokens, 512);
|
||||
|
||||
state.vectorCalls.length = 0;
|
||||
state.diffusionCalls.length = 0;
|
||||
|
||||
Reference in New Issue
Block a user