diff options
Diffstat (limited to 'packages/cli/src')
| -rw-r--r-- | packages/cli/src/ui/components/messages/InfoMessage.tsx | 2 | ||||
| -rw-r--r-- | packages/cli/src/ui/hooks/useGeminiStream.ts | 14 |
2 files changed, 13 insertions, 3 deletions
diff --git a/packages/cli/src/ui/components/messages/InfoMessage.tsx b/packages/cli/src/ui/components/messages/InfoMessage.tsx index b30e4473..c9129999 100644 --- a/packages/cli/src/ui/components/messages/InfoMessage.tsx +++ b/packages/cli/src/ui/components/messages/InfoMessage.tsx @@ -17,7 +17,7 @@ export const InfoMessage: React.FC<InfoMessageProps> = ({ text }) => { const prefixWidth = prefix.length; return ( - <Box flexDirection="row"> + <Box flexDirection="row" marginTop={1}> <Box width={prefixWidth}> <Text color={Colors.AccentYellow}>{prefix}</Text> </Box> diff --git a/packages/cli/src/ui/hooks/useGeminiStream.ts b/packages/cli/src/ui/hooks/useGeminiStream.ts index de073373..3f8cee40 100644 --- a/packages/cli/src/ui/hooks/useGeminiStream.ts +++ b/packages/cli/src/ui/hooks/useGeminiStream.ts @@ -177,8 +177,6 @@ export const useGeminiStream = ( let geminiMessageBuffer = ''; for await (const event of stream) { - if (signal.aborted) break; - if (event.type === ServerGeminiEventType.Content) { if ( pendingHistoryItemRef.current?.type !== 'gemini' && @@ -293,6 +291,18 @@ export const useGeminiStream = ( ); setStreamingState(StreamingState.WaitingForConfirmation); return; // Wait for user confirmation + } else if (event.type === ServerGeminiEventType.UserCancelled) { + // Flush out existing pending history item. + if (pendingHistoryItemRef.current) { + addItem(pendingHistoryItemRef.current, userMessageTimestamp); + setPendingHistoryItem(null); + } + addItem( + { type: 'info', text: 'User cancelled the request.' }, + userMessageTimestamp, + ); + setStreamingState(StreamingState.Idle); + return; // Stop processing the stream } } // End stream loop |
