fix: remove unnecessary unescapeMapOrSlice call in Gemini relay

The JSON serialization/deserialization already handles escape characters
correctly, so the unescapeMapOrSlice function is redundant.
This commit is contained in:
thirking
2026-02-03 11:47:45 +08:00
parent cbebd15692
commit 8d67c571e4

View File

@@ -988,11 +988,9 @@ func unescapeMapOrSlice(data interface{}) interface{} {
func getResponseToolCall(item *dto.GeminiPart) *dto.ToolCallResponse {
var argsBytes []byte
var err error
if result, ok := item.FunctionCall.Arguments.(map[string]interface{}); ok {
argsBytes, err = json.Marshal(unescapeMapOrSlice(result))
} else {
argsBytes, err = json.Marshal(item.FunctionCall.Arguments)
}
// 移除 unescapeMapOrSlice 调用,直接使用 json.Marshal
// JSON 序列化/反序列化已经正确处理了转义字符
argsBytes, err = json.Marshal(item.FunctionCall.Arguments)
if err != nil {
return nil