Fix/claude thinking tool call conversion (#3756)

Signed-off-by: wydream <yaodiwu618@gmail.com>
This commit is contained in:
woody
2026-05-20 11:34:07 +08:00
committed by GitHub
parent f1dfc8f3d2
commit e1e631263c
12 changed files with 1113 additions and 58 deletions

View File

@@ -100,6 +100,11 @@ func (m *zhipuAiProvider) TransformRequestBody(ctx wrapper.HttpContext, apiName
// Explicitly set thinking=disabled to prevent ZhipuAI from enabling it by default.
body, _ = sjson.SetBytes(body, "thinking", map[string]string{"type": "disabled"})
}
if requestBodyHasMessageReasoningContent(body) {
// Z.AI clears historical reasoning_content by default. Disable clearing only
// when the converted request actually carries reusable reasoning history.
body, _ = sjson.SetBytes(body, "thinking.clear_thinking", false)
}
return m.config.defaultTransformRequestBody(ctx, apiName, body)
}