diff options
| author | Neha Prasad <[email protected]> | 2025-07-28 23:27:33 +0530 |
|---|---|---|
| committer | GitHub <[email protected]> | 2025-07-28 17:57:33 +0000 |
| commit | a5ea113a8e485f42cc1136b6c57e337cbf369c57 (patch) | |
| tree | e1015846c86929c57577ccd2b6060f2624e666b0 /packages/cli/src/ui/hooks/useGeminiStream.ts | |
| parent | 379765da238ec113801648999be392cda5f690b8 (diff) | |
fix: Clear previous thoughts when starting new prompts (#4966)
Diffstat (limited to 'packages/cli/src/ui/hooks/useGeminiStream.ts')
| -rw-r--r-- | packages/cli/src/ui/hooks/useGeminiStream.ts | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/packages/cli/src/ui/hooks/useGeminiStream.ts b/packages/cli/src/ui/hooks/useGeminiStream.ts index 456c0fb7..c934a139 100644 --- a/packages/cli/src/ui/hooks/useGeminiStream.ts +++ b/packages/cli/src/ui/hooks/useGeminiStream.ts @@ -414,8 +414,9 @@ export const useGeminiStream = ( userMessageTimestamp, ); setIsResponding(false); + setThought(null); // Reset thought when user cancels }, - [addItem, pendingHistoryItemRef, setPendingHistoryItem], + [addItem, pendingHistoryItemRef, setPendingHistoryItem, setThought], ); const handleErrorEvent = useCallback( @@ -437,8 +438,9 @@ export const useGeminiStream = ( }, userMessageTimestamp, ); + setThought(null); // Reset thought when there's an error }, - [addItem, pendingHistoryItemRef, setPendingHistoryItem, config], + [addItem, pendingHistoryItemRef, setPendingHistoryItem, config, setThought], ); const handleFinishedEvent = useCallback( @@ -637,6 +639,7 @@ export const useGeminiStream = ( if (!options?.isContinuation) { startNewPrompt(); + setThought(null); // Reset thought when starting a new prompt } setIsResponding(true); |
