feat(zai): disable thinking controls for GLM-4.5/4.6; add UI note and stop sending reasoning params

This commit is contained in:
Roo Code 2025-11-08 22:35:15 +00:00
parent e98f4b9057
commit 8d01f53b7b
4 changed files with 12 additions and 12 deletions

View file

@ -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,

View file

@ -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(),
}),
)
})

View file

@ -48,6 +48,9 @@ export const ZAi = ({ apiConfiguration, setApiConfigurationField }: ZAiProps) =>
<div className="text-xs text-vscode-descriptionForeground mt-1">
{t("settings:providers.zaiEntrypointDescription")}
</div>
<div className="text-xs text-vscode-descriptionForeground mt-2">
{t("settings:providers.zaiThinkNote")}
</div>
</div>
<div>
<VSCodeTextField

View file

@ -309,6 +309,7 @@
"getZaiApiKey": "Get Z AI API Key",
"zaiEntrypoint": "Z AI Entrypoint",
"zaiEntrypointDescription": "Please select the appropriate API entrypoint based on your location. If you are in China, choose open.bigmodel.cn. Otherwise, choose api.z.ai.",
"zaiThinkNote": "Note: For coding agents, GLM-4.5 and GLM-4.6 were trained without 'think'. Thinking will be available in GLM-4.6 Air.",
"geminiApiKey": "Gemini API Key",
"getGroqApiKey": "Get Groq API Key",
"groqApiKey": "Groq API Key",