Merge pull request #1663 from hyperwd/fix/glm-nil-input

fix(providers): handle nil input in GLM series tool_use blocks
This commit is contained in:
Mauro 2026-03-17 08:42:17 +01:00 committed by GitHub
commit 8a8cc35645
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -221,11 +221,17 @@ func buildRequestBody(
// Add tool_use blocks
for _, tc := range msg.ToolCalls {
// Handle nil Arguments (GLM-4 may return null input)
input := tc.Arguments
if input == nil {
input = map[string]any{}
}
toolUse := map[string]any{
"type": "tool_use",
"id": tc.ID,
"name": tc.Name,
"input": tc.Arguments,
"input": input,
}
content = append(content, toolUse)
}