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:
parent
01971741e0
commit
7c3591f641
|
@ -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) => {
|
||||
|
|
Loading…
Reference in New Issue