Ver Fonte

fix(tui): remove default maxTokens from normal depth profile

The normal depth profile hardcoded maxTokens: 240, which was always
passed to the chat LLM call via getChatRequestOptions. This defeated
the "only pass maxTokens when /depth is explicitly set" fix in
project-tools.ts — thinking models like kimi-k2.5 were still
truncated at 240 tokens on the default TUI path.

Make maxTokens optional in ChatDepthProfile. Only light/deep depths
set it; normal leaves it undefined so the model decides its own
output length.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
fanghanjun há 7 meses atrás
pai
commit
a8954a63ba

+ 4 - 2
packages/cli/src/__tests__/tui-chat-depth.test.ts

@@ -9,12 +9,14 @@ describe("tui chat depth", () => {
       maxTokens: 160,
       label: "light",
     });
-    expect(resolveChatDepthProfile("normal")).toEqual({
+    const normal = resolveChatDepthProfile("normal");
+    expect(normal).toEqual({
       depth: "normal",
       temperature: 0.4,
-      maxTokens: 240,
       label: "normal",
     });
+    // normal depth must NOT include maxTokens — let the model decide
+    expect(normal.maxTokens).toBeUndefined();
     expect(resolveChatDepthProfile("deep")).toEqual({
       depth: "deep",
       temperature: 0.45,

+ 4 - 2
packages/cli/src/tui/chat-depth.ts

@@ -3,7 +3,7 @@ export type ChatDepth = "light" | "normal" | "deep";
 export interface ChatDepthProfile {
   readonly depth: ChatDepth;
   readonly temperature: number;
-  readonly maxTokens: number;
+  readonly maxTokens?: number;
   readonly label: string;
 }
 
@@ -15,6 +15,8 @@ export function resolveChatDepthProfile(depth: ChatDepth): ChatDepthProfile {
       return { depth, temperature: 0.45, maxTokens: 420, label: "deep" };
     case "normal":
     default:
-      return { depth: "normal", temperature: 0.4, maxTokens: 240, label: "normal" };
+      // No maxTokens — let the model decide its own output length.
+      // Only /depth light|deep explicitly caps tokens.
+      return { depth: "normal", temperature: 0.4, label: "normal" };
   }
 }