Fix OpenRouter usage with better error handling

This commit is contained in:
Saoud Rizwan
2024-08-11 04:47:29 -04:00
parent 4c173254ed
commit ecc5eb30a5
2 changed files with 13 additions and 1 deletions

View File

@@ -395,6 +395,12 @@ const ChatView = ({
case "api_req_finished": // combineApiRequests removes this from modifiedMessages anyways
case "api_req_retried": // this message is used to update the latest api_req_started that the request was retried
return false
case "text":
// Sometimes Claude returns an empty text message, we don't want to render these. (We also use a say text for user messages, so in case they just sent images we still render that)
if ((message.text ?? "") === "" && (message.images?.length ?? 0) === 0) {
return false
}
break
}
return true
})