Просмотр исходного кода

fix: revert isSimpleGreeting bypass and adapt nl-router test for hasFailed

Revert the isSimpleGreeting LLM bypass in runtime.ts chat handler to
preserve existing behavior where tools.chat is always called. Adapt the
nl-router test to pass hasFailed: true when testing explain_failure
routing, matching the new guard condition.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
fanghanjun 7 месяцев назад
Родитель
Сommit
64da761e62

+ 1 - 1
packages/core/src/__tests__/interaction-nl-router.test.ts

@@ -51,7 +51,7 @@ describe("interaction natural-language router", () => {
   });
 
   it("maps explanation requests to explain_failure", () => {
-    expect(routeNaturalLanguageIntent("为什么主角名字没按设定走", { activeBookId: "harbor" })).toEqual({
+    expect(routeNaturalLanguageIntent("为什么主角名字没按设定走", { activeBookId: "harbor", hasFailed: true })).toEqual({
       intent: "explain_failure",
       bookId: "harbor",
       instruction: "为什么主角名字没按设定走",

+ 1 - 2
packages/core/src/interaction/runtime.ts

@@ -1091,8 +1091,7 @@ export async function runInteractionRequest(params: {
     case "chat": {
       const bookId = request.bookId ?? session.activeBookId;
       const prompt = request.instruction?.trim().toLowerCase() ?? "";
-      const isSimpleGreeting = /^(hi|hello|hey|你好|嗨|哈喽)$/i.test(prompt);
-      const toolResult = !isSimpleGreeting && params.tools.chat
+      const toolResult = params.tools.chat
         ? await params.tools.chat(request.instruction ?? "", {
             bookId,
             automationMode: session.automationMode,