From 5b7254f17e463e12b131036569d2fa9bfec93564 Mon Sep 17 00:00:00 2001 From: dreamhunter2333 Date: Sat, 31 Jan 2026 15:57:18 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=20Claude=20=E5=8D=8F?= =?UTF-8?q?=E8=AE=AE=E8=BD=AC=E6=8D=A2=E4=B8=AD=20tool=5Fresult=20?= =?UTF-8?q?=E6=B6=88=E6=81=AF=E5=AF=BC=E8=87=B4=E7=A9=BA=20user=20?= =?UTF-8?q?=E6=B6=88=E6=81=AF=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 当 Claude 消息内容全部为 tool_result 块时,转换后的 OpenAI 消息会缺少 content 字段, 导致后端(如 minimax)返回 400 错误。 Co-Authored-By: Claude Opus 4.5 --- src/providers/claude-to-openai-proxy.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/providers/claude-to-openai-proxy.ts b/src/providers/claude-to-openai-proxy.ts index 6733da1..d0a903b 100644 --- a/src/providers/claude-to-openai-proxy.ts +++ b/src/providers/claude-to-openai-proxy.ts @@ -182,7 +182,10 @@ const convertClaudeToOpenAIRequest = (reqJson: any): any => { } } - messages.push(openaiMsg); + // 只有当消息有实际内容时才添加(避免空 user 消息) + if (openaiMsg.content != null || openaiMsg.tool_calls) { + messages.push(openaiMsg); + } } }