Narrow trivial input skip rules

This commit is contained in:
Hao19911125
2026-04-05 23:52:59 +08:00
parent e3c819b5cf
commit d77b64e05a
2 changed files with 3 additions and 50 deletions

View File

@@ -21,9 +21,9 @@ function testIsTrivialUserInputTable() {
["/echo hello", true, "slash-command"],
["/", true, "slash-command"],
[" /echo", true, "slash-command"],
["a", true, "under-min-tokens"],
["好", true, "under-min-tokens"],
["ok", true, "under-min-tokens"],
["a", false, ""],
["好", false, ""],
["ok", false, ""],
["ok a", false, ""],
["好的", false, ""],
["好的呀", false, ""],
@@ -68,27 +68,6 @@ async function testSlashCommandSkipsRecallAndExtraction() {
assert.equal(harness.result.getCurrentGenerationTrivialSkip(), null);
}
async function testUnderMinTokensSkipsRecallAndExtraction() {
const harness = await createGenerationRecallHarness();
harness.chat = [];
harness.__sendTextareaValue = "a";
const startResult = harness.result.onGenerationStarted("normal", {}, false);
assert.equal(startResult, null);
assert.equal(
harness.result.getCurrentGenerationTrivialSkip()?.reason,
"under-min-tokens",
);
await harness.result.onGenerationAfterCommands("normal", {}, false);
assert.equal(harness.runRecallCalls.length, 0);
harness.chat.push({ is_user: false, mes: "assistant reply" });
harness.invokeOnMessageReceived(0, "");
assert.equal(harness.runExtractionCalls.length, 0);
assert.equal(harness.result.getCurrentGenerationTrivialSkip(), null);
}
async function testEmptyInputSkipsPriorHistoryFallback() {
const harness = await createGenerationRecallHarness();
harness.chat = [{ is_user: true, mes: "older real user message" }];
@@ -284,7 +263,6 @@ async function testSkipFlagTtlExpires() {
await Promise.resolve();
testIsTrivialUserInputTable();
await testSlashCommandSkipsRecallAndExtraction();
await testUnderMinTokensSkipsRecallAndExtraction();
await testEmptyInputSkipsPriorHistoryFallback();
await testNormalInputStillRecalls();
await testSentinelBlocksHistoryFallback();