Merge pull request #2814 from thirking/fix/remove-unescape-function

fix: 移除不必要的 unescapeMapOrSlice 调用,修复 Windows 路径转义问题
This commit is contained in:
Calcium-Ion
2026-02-03 17:42:09 +08:00
committed by GitHub

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