diff options
| author | Asad Memon <[email protected]> | 2025-06-15 11:19:05 -0700 |
|---|---|---|
| committer | GitHub <[email protected]> | 2025-06-15 18:19:05 +0000 |
| commit | 123ad20e9bfc5cf47eca4fe0e073ecef67a639f9 (patch) | |
| tree | 57621474cdb291993fe1c148b1362835c5960b60 /packages/cli/src/ui/hooks | |
| parent | b3d89a10758462947546a7d9be43bf617c0787c6 (diff) | |
feat: Show model thoughts while loading (#992)
Diffstat (limited to 'packages/cli/src/ui/hooks')
| -rw-r--r-- | packages/cli/src/ui/hooks/useGeminiStream.ts | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/packages/cli/src/ui/hooks/useGeminiStream.ts b/packages/cli/src/ui/hooks/useGeminiStream.ts index bff38a2b..51d32506 100644 --- a/packages/cli/src/ui/hooks/useGeminiStream.ts +++ b/packages/cli/src/ui/hooks/useGeminiStream.ts @@ -21,6 +21,7 @@ import { logUserPrompt, GitService, EditorType, + ThoughtSummary, } from '@gemini-cli/core'; import { type Part, type PartListUnion } from '@google/genai'; import { @@ -90,6 +91,7 @@ export const useGeminiStream = ( const [initError, setInitError] = useState<string | null>(null); const abortControllerRef = useRef<AbortController | null>(null); const [isResponding, setIsResponding] = useState<boolean>(false); + const [thought, setThought] = useState<ThoughtSummary | null>(null); const [pendingHistoryItemRef, setPendingHistoryItem] = useStateAndRef<HistoryItemWithoutId | null>(null); const logger = useLogger(); @@ -393,6 +395,9 @@ export const useGeminiStream = ( const toolCallRequests: ToolCallRequestInfo[] = []; for await (const event of stream) { switch (event.type) { + case ServerGeminiEventType.Thought: + setThought(event.value); + break; case ServerGeminiEventType.Content: geminiMessageBuffer = handleContentEvent( event.value, @@ -730,5 +735,6 @@ export const useGeminiStream = ( submitQuery, initError, pendingHistoryItems, + thought, }; }; |
