From 123ad20e9bfc5cf47eca4fe0e073ecef67a639f9 Mon Sep 17 00:00:00 2001 From: Asad Memon Date: Sun, 15 Jun 2025 11:19:05 -0700 Subject: feat: Show model thoughts while loading (#992) --- packages/cli/src/ui/hooks/useGeminiStream.ts | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'packages/cli/src/ui/hooks') 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(null); const abortControllerRef = useRef(null); const [isResponding, setIsResponding] = useState(false); + const [thought, setThought] = useState(null); const [pendingHistoryItemRef, setPendingHistoryItem] = useStateAndRef(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, }; }; -- cgit v1.2.3