mirror of
https://github.com/router-for-me/CLIProxyAPI.git
synced 2026-02-02 20:40:52 +08:00
Fixed: #121
feat(translator): map Claude web search tool type to Codex web_search
- Added special handling to replace `web_search_20250305` tool type with `{"type":"web_search"}` in Claude request processing.
This commit is contained in:
@@ -186,6 +186,12 @@ func ConvertClaudeRequestToCodex(modelName string, inputRawJSON []byte, _ bool)
|
|||||||
shortMap := buildShortNameMap(names)
|
shortMap := buildShortNameMap(names)
|
||||||
for i := 0; i < len(toolResults); i++ {
|
for i := 0; i < len(toolResults); i++ {
|
||||||
toolResult := toolResults[i]
|
toolResult := toolResults[i]
|
||||||
|
// Special handling: map Claude web search tool to Codex web_search
|
||||||
|
if toolResult.Get("type").String() == "web_search_20250305" {
|
||||||
|
// Replace the tool content entirely with {"type":"web_search"}
|
||||||
|
template, _ = sjson.SetRaw(template, "tools.-1", `{"type":"web_search"}`)
|
||||||
|
continue
|
||||||
|
}
|
||||||
tool := toolResult.Raw
|
tool := toolResult.Raw
|
||||||
tool, _ = sjson.Set(tool, "type", "function")
|
tool, _ = sjson.Set(tool, "type", "function")
|
||||||
// Apply shortened name if needed
|
// Apply shortened name if needed
|
||||||
|
|||||||
Reference in New Issue
Block a user