Commit b7b23472 by Yan

fix: 转义 Gemini 工具调用中的反斜杠

parent b632c650
...@@ -296,7 +296,8 @@ func getToolCall(item *GeminiPart) *dto.ToolCall { ...@@ -296,7 +296,8 @@ func getToolCall(item *GeminiPart) *dto.ToolCall {
ID: fmt.Sprintf("call_%s", common.GetUUID()), ID: fmt.Sprintf("call_%s", common.GetUUID()),
Type: "function", Type: "function",
Function: dto.FunctionCall{ Function: dto.FunctionCall{
Arguments: string(argsBytes), // 不好评价,得去转义一下反斜杠,Gemini 的特性好像是,Google 返回的时候本身就会转义“\”
Arguments: strings.ReplaceAll(string(argsBytes), "\\\\", "\\"),
Name: item.FunctionCall.FunctionName, Name: item.FunctionCall.FunctionName,
}, },
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment