fix: Fix google provider in app (#859)

This commit is contained in:
Bradley Axen
2025-01-28 15:12:45 -08:00
committed by GitHub
parent f7a980617e
commit 954bdb4842
3 changed files with 20 additions and 6 deletions
@@ -89,8 +89,18 @@ export async function processCustomChatResponse({
onTextPart(value) {
// If the last event wasn't text, or we don't have a current message, create a new one
if (lastEventType !== 'text' || currentMessage == null) {
archiveCurrentMessage();
currentMessage = createNewMessage();
// Only archive if there are no tool invocations in 'call' state
const hasPendingToolCalls =
currentMessage?.toolInvocations?.some((invocation) => invocation.state === 'call') ??
false;
if (!hasPendingToolCalls) {
archiveCurrentMessage();
}
if (!currentMessage) {
currentMessage = createNewMessage();
}
currentMessage.content = value;
} else {
// Concatenate with the existing message