From 8d01f53b7bf0b9135c5c1ac139e1091fd62cef76 Mon Sep 17 00:00:00 2001 From: Roo Code Date: Sat, 8 Nov 2025 22:35:15 +0000 Subject: [PATCH] feat(zai): disable thinking controls for GLM-4.5/4.6; add UI note and stop sending reasoning params --- packages/types/src/providers/zai.ts | 4 ---- src/api/providers/__tests__/zai.spec.ts | 16 ++++++++-------- .../src/components/settings/providers/ZAi.tsx | 3 +++ webview-ui/src/i18n/locales/en/settings.json | 1 + 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/packages/types/src/providers/zai.ts b/packages/types/src/providers/zai.ts index 2db7732230..2b156cfb51 100644 --- a/packages/types/src/providers/zai.ts +++ b/packages/types/src/providers/zai.ts @@ -16,7 +16,6 @@ export const internationalZAiModels = { contextWindow: 131_072, supportsImages: false, supportsPromptCache: true, - supportsReasoningBinary: true, inputPrice: 0.6, outputPrice: 2.2, cacheWritesPrice: 0, @@ -87,7 +86,6 @@ export const internationalZAiModels = { contextWindow: 200_000, supportsImages: false, supportsPromptCache: true, - supportsReasoningBinary: true, inputPrice: 0.6, outputPrice: 2.2, cacheWritesPrice: 0, @@ -116,7 +114,6 @@ export const mainlandZAiModels = { contextWindow: 131_072, supportsImages: false, supportsPromptCache: true, - supportsReasoningBinary: true, inputPrice: 0.29, outputPrice: 1.14, cacheWritesPrice: 0, @@ -187,7 +184,6 @@ export const mainlandZAiModels = { contextWindow: 204_800, supportsImages: false, supportsPromptCache: true, - supportsReasoningBinary: true, inputPrice: 0.29, outputPrice: 1.14, cacheWritesPrice: 0, diff --git a/src/api/providers/__tests__/zai.spec.ts b/src/api/providers/__tests__/zai.spec.ts index 9db5350080..59d599977a 100644 --- a/src/api/providers/__tests__/zai.spec.ts +++ b/src/api/providers/__tests__/zai.spec.ts @@ -297,9 +297,9 @@ describe("ZAiHandler", () => { }) describe("Reasoning functionality", () => { - it("should include thinking parameter when enableReasoningEffort is true and model supports reasoning in createMessage", async () => { + it("should not include thinking parameter when enableReasoningEffort is true for GLM-4.6 (no think for coding agents)", async () => { const handlerWithReasoning = new ZAiHandler({ - apiModelId: "glm-4.6", // GLM-4.6 has supportsReasoningBinary: true + apiModelId: "glm-4.6", zaiApiKey: "test-zai-api-key", zaiApiLine: "international_coding", enableReasoningEffort: true, @@ -322,8 +322,8 @@ describe("ZAiHandler", () => { await messageGenerator.next() expect(mockCreate).toHaveBeenCalledWith( - expect.objectContaining({ - thinking: { type: "enabled" }, + expect.not.objectContaining({ + thinking: expect.anything(), }), undefined, ) @@ -393,9 +393,9 @@ describe("ZAiHandler", () => { ) }) - it("should include thinking parameter when enableReasoningEffort is true and model supports reasoning in completePrompt", async () => { + it("should not include thinking parameter when enableReasoningEffort is true for GLM-4.5 (no think for coding agents) in completePrompt", async () => { const handlerWithReasoning = new ZAiHandler({ - apiModelId: "glm-4.5", // GLM-4.5 has supportsReasoningBinary: true + apiModelId: "glm-4.5", zaiApiKey: "test-zai-api-key", zaiApiLine: "international_coding", enableReasoningEffort: true, @@ -407,8 +407,8 @@ describe("ZAiHandler", () => { await handlerWithReasoning.completePrompt("test prompt") expect(mockCreate).toHaveBeenCalledWith( - expect.objectContaining({ - thinking: { type: "enabled" }, + expect.not.objectContaining({ + thinking: expect.anything(), }), ) }) diff --git a/webview-ui/src/components/settings/providers/ZAi.tsx b/webview-ui/src/components/settings/providers/ZAi.tsx index c7f44510c1..84079a117f 100644 --- a/webview-ui/src/components/settings/providers/ZAi.tsx +++ b/webview-ui/src/components/settings/providers/ZAi.tsx @@ -48,6 +48,9 @@ export const ZAi = ({ apiConfiguration, setApiConfigurationField }: ZAiProps) =>
{t("settings:providers.zaiEntrypointDescription")}
+
+ {t("settings:providers.zaiThinkNote")} +