fix anthropic empty err message

This commit is contained in:
Andrew Pareles 2025-05-13 17:25:29 -07:00
parent f4c1321f25
commit 6df3b588df

View file

@ -418,6 +418,7 @@ const prepareOpenAIOrAnthropicMessages = ({
else {
// allowed to be empty if has a tool in it or following it
if (currMsg.content.find(c => c.type === 'tool_result' || c.type === 'tool_use')) {
currMsg.content = currMsg.content.filter(c => !(c.type === 'text' && !c.text)) as any
continue
}
if (nextMsg?.role === 'tool') continue