mirror of
https://github.com/router-for-me/CLIProxyAPI.git
synced 2026-02-18 20:30:51 +08:00
fix(translator): correct funcName extraction and ensure proper handling of function response data in Antigravity Claude requests
This commit is contained in:
@@ -122,9 +122,17 @@ func ConvertClaudeRequestToAntigravity(modelName string, inputRawJSON []byte, _
|
|||||||
funcName := toolCallID
|
funcName := toolCallID
|
||||||
toolCallIDs := strings.Split(toolCallID, "-")
|
toolCallIDs := strings.Split(toolCallID, "-")
|
||||||
if len(toolCallIDs) > 1 {
|
if len(toolCallIDs) > 1 {
|
||||||
funcName = strings.Join(toolCallIDs[0:len(toolCallIDs)-1], "-")
|
funcName = strings.Join(toolCallIDs[0:len(toolCallIDs)-2], "-")
|
||||||
}
|
}
|
||||||
responseData := contentResult.Get("content").Raw
|
functionResponseResult := contentResult.Get("content")
|
||||||
|
|
||||||
|
responseData := ""
|
||||||
|
if functionResponseResult.Type == gjson.String {
|
||||||
|
responseData = functionResponseResult.String()
|
||||||
|
} else {
|
||||||
|
responseData = contentResult.Get("content").Raw
|
||||||
|
}
|
||||||
|
|
||||||
functionResponse := client.FunctionResponse{ID: toolCallID, Name: funcName, Response: map[string]interface{}{"result": responseData}}
|
functionResponse := client.FunctionResponse{ID: toolCallID, Name: funcName, Response: map[string]interface{}{"result": responseData}}
|
||||||
clientContent.Parts = append(clientContent.Parts, client.Part{FunctionResponse: &functionResponse})
|
clientContent.Parts = append(clientContent.Parts, client.Part{FunctionResponse: &functionResponse})
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user