Bypass trivial planner and empty-turn hooks

This commit is contained in:
Hao19911125
2026-04-05 22:28:29 +08:00
parent 97fb8e4e2b
commit 438577959b
4 changed files with 37 additions and 14 deletions

View File

@@ -89,6 +89,28 @@ async function testUnderMinTokensSkipsRecallAndExtraction() {
assert.equal(harness.result.getCurrentGenerationTrivialSkip(), null);
}
async function testEmptyInputSkipsPriorHistoryFallback() {
const harness = await createGenerationRecallHarness();
harness.chat = [{ is_user: true, mes: "older real user message" }];
harness.__sendTextareaValue = " ";
const startResult = harness.result.onGenerationStarted("normal", {}, false);
assert.equal(startResult, null);
assert.equal(
harness.result.getCurrentGenerationTrivialSkip()?.reason,
"empty",
);
await harness.result.onGenerationAfterCommands("normal", {}, false);
assert.equal(harness.runRecallCalls.length, 0);
const beforeCombine = await harness.result.onBeforeCombinePrompts();
assert.deepEqual(beforeCombine, {
skipped: true,
reason: "trivial:empty",
});
}
async function testNormalInputStillRecalls() {
const harness = await createGenerationRecallHarness();
harness.chat = [];
@@ -263,6 +285,7 @@ await Promise.resolve();
testIsTrivialUserInputTable();
await testSlashCommandSkipsRecallAndExtraction();
await testUnderMinTokensSkipsRecallAndExtraction();
await testEmptyInputSkipsPriorHistoryFallback();
await testNormalInputStillRecalls();
await testSentinelBlocksHistoryFallback();
await testAfterCommandsTrivialSentinelMarksExtractionBypass();