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;
};
const streamingState: StreamingState =
isResponding ||
toolCalls.some(
(t) => t.status === 'awaiting_approval' || t.status === 'executing',
)
? StreamingState.Responding
: StreamingState.Idle;
const streamingState: StreamingState = (() => {
if (toolCalls.some((t) => t.status === 'awaiting_approval')) {
return StreamingState.WaitingForConfirmation;
}
if (isResponding || toolCalls.some((t) => t.status === 'executing')) {
return StreamingState.Responding;
}
return StreamingState.Idle;
})();
const submitQuery = useCallback(
async (query: PartListUnion) => {