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:
commit
8a8cc35645
1 changed files with 7 additions and 1 deletions
|
|
@ -221,11 +221,17 @@ func buildRequestBody(
|
||||||
|
|
||||||
// Add tool_use blocks
|
// Add tool_use blocks
|
||||||
for _, tc := range msg.ToolCalls {
|
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{
|
toolUse := map[string]any{
|
||||||
"type": "tool_use",
|
"type": "tool_use",
|
||||||
"id": tc.ID,
|
"id": tc.ID,
|
||||||
"name": tc.Name,
|
"name": tc.Name,
|
||||||
"input": tc.Arguments,
|
"input": input,
|
||||||
}
|
}
|
||||||
content = append(content, toolUse)
|
content = append(content, toolUse)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue