mirror of
https://github.com/QuantumNous/new-api.git
synced 2026-09-07 01:56:53 +00:00
fix: 工具调用 arguments 为空时保留 tool_use 块 (#5543)
This commit is contained in:
@@ -410,9 +410,10 @@ func RequestOpenAI2ClaudeMessage(c *gin.Context, textRequest dto.GeneralOpenAIRe
|
|||||||
if message.ToolCalls != nil {
|
if message.ToolCalls != nil {
|
||||||
for _, toolCall := range message.ParseToolCalls() {
|
for _, toolCall := range message.ParseToolCalls() {
|
||||||
inputObj := make(map[string]any)
|
inputObj := make(map[string]any)
|
||||||
if err := json.Unmarshal([]byte(toolCall.Function.Arguments), &inputObj); err != nil {
|
if args := toolCall.Function.Arguments; args != "" {
|
||||||
common.SysLog("tool call function arguments is not a map[string]any: " + fmt.Sprintf("%v", toolCall.Function.Arguments))
|
if err := json.Unmarshal([]byte(args), &inputObj); err != nil {
|
||||||
continue
|
common.SysLog("tool call function arguments is not a map[string]any: " + fmt.Sprintf("%v", toolCall.Function.Arguments))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
claudeMediaMessages = append(claudeMediaMessages, dto.ClaudeMediaMessage{
|
claudeMediaMessages = append(claudeMediaMessages, dto.ClaudeMediaMessage{
|
||||||
Type: "tool_use",
|
Type: "tool_use",
|
||||||
|
|||||||
Reference in New Issue
Block a user