fix(antigravity): validate function arguments before serialization Ensure `function.arguments` is a valid JSON before setting raw bytes, fallback to setting as parameterized content if invalid.
Unified · Split
| @@ -266,7 +266,11 @@ func ConvertOpenAIRequestToAntigravity(modelName string, inputRawJSON []byte, _ · 265 unmodified lines | |||
| 266 | fargs := tc.Get("function.arguments").String() | 266 | fargs := tc.Get("function.arguments").String() |
| 267 | node, _ = sjson.SetBytes(node, "parts."+itoa(p)+".functionCall.id", fid) | 267 | node, _ = sjson.SetBytes(node, "parts."+itoa(p)+".functionCall.id", fid) |
| 268 | node, _ = sjson.SetBytes(node, "parts."+itoa(p)+".functionCall.name", fname) | 268 | node, _ = sjson.SetBytes(node, "parts."+itoa(p)+".functionCall.name", fname) |
| 269 | node, _ = sjson.SetRawBytes(node, "parts."+itoa(p)+".functionCall.args", []byte(fargs)) | 269 | if gjson.Valid(fargs) { |
| 270 | node, _ = sjson.SetRawBytes(node, "parts."+itoa(p)+".functionCall.args", []byte(fargs)) | ||
| 271 | } else { | ||
| 272 | node, _ = sjson.SetBytes(node, "parts."+itoa(p)+".functionCall.args.params", []byte(fargs)) | ||
| 273 | } | ||
| 270 | node, _ = sjson.SetBytes(node, "parts."+itoa(p)+".thoughtSignature", geminiCLIFunctionThoughtSignature) | 274 | node, _ = sjson.SetBytes(node, "parts."+itoa(p)+".thoughtSignature", geminiCLIFunctionThoughtSignature) |
| 271 | p++ | 275 | p++ |
| 272 | if fid != "" { | 276 | if fid != "" { |