fix: remove reasoning toggles for GLM-4.5 and GLM-4.6 on z.ai provider (#9752)

Co-authored-by: Roo Code <roomote@roocode.com>
This commit is contained in:
roomote[bot] 2025-12-02 14:20:48 -05:00 committed by GitHub
parent be69ef901e
commit 9a1d7a673b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 0 additions and 142 deletions

View file

@ -17,7 +17,6 @@ export const internationalZAiModels = {
supportsImages: false,
supportsPromptCache: true,
supportsNativeTools: true,
supportsReasoningBinary: true,
inputPrice: 0.6,
outputPrice: 2.2,
cacheWritesPrice: 0,
@ -94,7 +93,6 @@ export const internationalZAiModels = {
supportsImages: false,
supportsPromptCache: true,
supportsNativeTools: true,
supportsReasoningBinary: true,
inputPrice: 0.6,
outputPrice: 2.2,
cacheWritesPrice: 0,
@ -125,7 +123,6 @@ export const mainlandZAiModels = {
supportsImages: false,
supportsPromptCache: true,
supportsNativeTools: true,
supportsReasoningBinary: true,
inputPrice: 0.29,
outputPrice: 1.14,
cacheWritesPrice: 0,
@ -202,7 +199,6 @@ export const mainlandZAiModels = {
supportsImages: false,
supportsPromptCache: true,
supportsNativeTools: true,
supportsReasoningBinary: true,
inputPrice: 0.29,
outputPrice: 1.14,
cacheWritesPrice: 0,

View file

@ -295,143 +295,5 @@ describe("ZAiHandler", () => {
undefined,
)
})
describe("Reasoning functionality", () => {
it("should include thinking parameter when enableReasoningEffort is true and model supports reasoning in createMessage", async () => {
const handlerWithReasoning = new ZAiHandler({
apiModelId: "glm-4.6", // GLM-4.6 has supportsReasoningBinary: true
zaiApiKey: "test-zai-api-key",
zaiApiLine: "international_coding",
enableReasoningEffort: true,
})
mockCreate.mockImplementationOnce(() => {
return {
[Symbol.asyncIterator]: () => ({
async next() {
return { done: true }
},
}),
}
})
const systemPrompt = "Test system prompt"
const messages: Anthropic.Messages.MessageParam[] = [{ role: "user", content: "Test message" }]
const messageGenerator = handlerWithReasoning.createMessage(systemPrompt, messages)
await messageGenerator.next()
expect(mockCreate).toHaveBeenCalledWith(
expect.objectContaining({
thinking: { type: "enabled" },
}),
undefined,
)
})
it("should not include thinking parameter when enableReasoningEffort is false in createMessage", async () => {
const handlerWithoutReasoning = new ZAiHandler({
apiModelId: "glm-4.6", // GLM-4.6 has supportsReasoningBinary: true
zaiApiKey: "test-zai-api-key",
zaiApiLine: "international_coding",
enableReasoningEffort: false,
})
mockCreate.mockImplementationOnce(() => {
return {
[Symbol.asyncIterator]: () => ({
async next() {
return { done: true }
},
}),
}
})
const systemPrompt = "Test system prompt"
const messages: Anthropic.Messages.MessageParam[] = [{ role: "user", content: "Test message" }]
const messageGenerator = handlerWithoutReasoning.createMessage(systemPrompt, messages)
await messageGenerator.next()
expect(mockCreate).toHaveBeenCalledWith(
expect.not.objectContaining({
thinking: expect.anything(),
}),
undefined,
)
})
it("should not include thinking parameter when model does not support reasoning in createMessage", async () => {
const handlerWithNonReasoningModel = new ZAiHandler({
apiModelId: "glm-4-32b-0414-128k", // This model doesn't have supportsReasoningBinary: true
zaiApiKey: "test-zai-api-key",
zaiApiLine: "international_coding",
enableReasoningEffort: true,
})
mockCreate.mockImplementationOnce(() => {
return {
[Symbol.asyncIterator]: () => ({
async next() {
return { done: true }
},
}),
}
})
const systemPrompt = "Test system prompt"
const messages: Anthropic.Messages.MessageParam[] = [{ role: "user", content: "Test message" }]
const messageGenerator = handlerWithNonReasoningModel.createMessage(systemPrompt, messages)
await messageGenerator.next()
expect(mockCreate).toHaveBeenCalledWith(
expect.not.objectContaining({
thinking: expect.anything(),
}),
undefined,
)
})
it("should include thinking parameter when enableReasoningEffort is true and model supports reasoning in completePrompt", async () => {
const handlerWithReasoning = new ZAiHandler({
apiModelId: "glm-4.5", // GLM-4.5 has supportsReasoningBinary: true
zaiApiKey: "test-zai-api-key",
zaiApiLine: "international_coding",
enableReasoningEffort: true,
})
const expectedResponse = "This is a test response"
mockCreate.mockResolvedValueOnce({ choices: [{ message: { content: expectedResponse } }] })
await handlerWithReasoning.completePrompt("test prompt")
expect(mockCreate).toHaveBeenCalledWith(
expect.objectContaining({
thinking: { type: "enabled" },
}),
)
})
it("should not include thinking parameter when enableReasoningEffort is false in completePrompt", async () => {
const handlerWithoutReasoning = new ZAiHandler({
apiModelId: "glm-4.5", // GLM-4.5 has supportsReasoningBinary: true
zaiApiKey: "test-zai-api-key",
zaiApiLine: "international_coding",
enableReasoningEffort: false,
})
const expectedResponse = "This is a test response"
mockCreate.mockResolvedValueOnce({ choices: [{ message: { content: expectedResponse } }] })
await handlerWithoutReasoning.completePrompt("test prompt")
expect(mockCreate).toHaveBeenCalledWith(
expect.not.objectContaining({
thinking: expect.anything(),
}),
)
})
})
})
})