Refactor: Update streaming state logic to hide loader during confirmation

- The streaming state logic in `useGeminiStream.ts` has been updated.
- Previously, the loading indicator was displayed even when the system was
waiting for user confirmation on a tool call.
- This change introduces a `WaitingForConfirmation` state to ensure the
loading indicator is hidden during these confirmation prompts, improving
the user experience.
This commit is contained in:
Taylor Mullen 2025-05-23 00:35:09 -07:00 committed by N. Taylor Mullen
parent 01971741e0
commit 7c3591f641
1 changed files with 9 additions and 7 deletions

View File

@ -394,13 +394,15 @@ export const useGeminiStream = (
return StreamProcessingStatus.Completed; return StreamProcessingStatus.Completed;
}; };
const streamingState: StreamingState = const streamingState: StreamingState = (() => {
isResponding || if (toolCalls.some((t) => t.status === 'awaiting_approval')) {
toolCalls.some( return StreamingState.WaitingForConfirmation;
(t) => t.status === 'awaiting_approval' || t.status === 'executing', }
) if (isResponding || toolCalls.some((t) => t.status === 'executing')) {
? StreamingState.Responding return StreamingState.Responding;
: StreamingState.Idle; }
return StreamingState.Idle;
})();
const submitQuery = useCallback( const submitQuery = useCallback(
async (query: PartListUnion) => { async (query: PartListUnion) => {