feat: 完善格式抓换,修复gemini渠道和openai渠道在claude code中使用的问题

This commit is contained in:
CaIon
2025-08-08 16:45:37 +08:00
parent 9f452e4781
commit 5b5b97eb30
6 changed files with 98 additions and 14 deletions
+12
View File
@@ -199,6 +199,18 @@ type ClaudeRequest struct {
Thinking *Thinking `json:"thinking,omitempty"`
}
func (c *ClaudeRequest) SearchToolNameByToolCallId(toolCallId string) string {
for _, message := range c.Messages {
content, _ := message.ParseContent()
for _, mediaMessage := range content {
if mediaMessage.Id == toolCallId {
return mediaMessage.Name
}
}
}
return ""
}
// AddTool 添加工具到请求中
func (c *ClaudeRequest) AddTool(tool any) {
if c.Tools == nil {