From c0eab31c023e16de55302d06013a2abfb7f7aca9 Mon Sep 17 00:00:00 2001 From: Taylor Mullen Date: Sat, 10 May 2025 00:24:33 -0700 Subject: [PATCH] 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 --- packages/cli/src/ui/hooks/useGeminiStream.ts | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/packages/cli/src/ui/hooks/useGeminiStream.ts b/packages/cli/src/ui/hooks/useGeminiStream.ts index e86ae0b9..dbcb4e64 100644 --- a/packages/cli/src/ui/hooks/useGeminiStream.ts +++ b/packages/cli/src/ui/hooks/useGeminiStream.ts @@ -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);