Show model decline/cancellation states.

- Upon decline / cancellation we weren't showing the model the cancellation status or states. Therefore it didn't know why things would or wouldn't happen

Fixes https://b.corp.google.com/issues/416797704
This commit is contained in:
Taylor Mullen 2025-05-10 00:24:33 -07:00 committed by N. Taylor Mullen
parent 6b518dc9e4
commit c0eab31c02
1 changed files with 9 additions and 0 deletions

View File

@ -509,6 +509,15 @@ export const useGeminiStream = (
error: new Error(declineMessage),
};
// Update conversation history without re-issuing another request to indicate the decline.
const history = chatSessionRef.current?.getHistory();
if (history) {
history.push({
role: 'model',
parts: [functionResponse],
});
}
// Update UI to show cancellation/error
updateFunctionResponseUI(responseInfo, status);
setStreamingState(StreamingState.Idle);