fix: 修复 Claude 协议转换中 tool_result 消息导致空 user 消息的问题
当 Claude 消息内容全部为 tool_result 块时,转换后的 OpenAI 消息会缺少 content 字段, 导致后端(如 minimax)返回 400 错误。 Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
a374078966
commit
5b7254f17e
1 file changed
+4
-1
@@ -182,7 +182,10 @@ const convertClaudeToOpenAIRequest = (reqJson: any): any => {
|
||||
}
|
||||
}
|
||||
|
||||
messages.push(openaiMsg);
|
||||
// 只有当消息有实际内容时才添加(避免空 user 消息)
|
||||
if (openaiMsg.content != null || openaiMsg.tool_calls) {
|
||||
messages.push(openaiMsg);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user