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;
|
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) => {
|
||||||
|
|
Loading…
Reference in New Issue