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

This commit is contained in:
CaIon
2025-08-08 16:45:37 +08:00
parent cda4790219
commit daa7a13505
6 changed files with 98 additions and 14 deletions

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 {