From 4576f9915b9834c46f93fa18c3cbbf63cc10eae5 Mon Sep 17 00:00:00 2001 From: Luis Pater Date: Wed, 15 Oct 2025 09:32:12 +0800 Subject: [PATCH] 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. --- internal/translator/codex/claude/codex_claude_request.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/internal/translator/codex/claude/codex_claude_request.go b/internal/translator/codex/claude/codex_claude_request.go index 8036d5d5..21d47f41 100644 --- a/internal/translator/codex/claude/codex_claude_request.go +++ b/internal/translator/codex/claude/codex_claude_request.go @@ -186,6 +186,12 @@ func ConvertClaudeRequestToCodex(modelName string, inputRawJSON []byte, _ bool) shortMap := buildShortNameMap(names) for i := 0; i < len(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, _ = sjson.Set(tool, "type", "function") // Apply shortened name if needed