mirror of
https://github.com/RooVetGit/Roo-Code.git
synced 2026-08-28 05:27:24 +00:00
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:
parent
be69ef901e
commit
9a1d7a673b
2 changed files with 0 additions and 142 deletions
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -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(),
|
||||
}),
|
||||
)
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue