feat: Modify loading indicator to support a paused state (#506)

This commit is contained in:
Jacob Richman
2025-05-23 10:25:17 -07:00
committed by GitHub
parent e993181628
commit 91ee02898a
10 changed files with 542 additions and 50 deletions

View File

@@ -182,8 +182,17 @@ export const App = ({
handleSlashCommand,
shellModeActive,
);
const { elapsedTime, currentLoadingPhrase } =
useLoadingIndicator(streamingState);
const isPausedForConfirmation = useMemo(
() =>
pendingHistoryItems.some(
(item) =>
item?.type === 'tool_group' &&
item.tools.some((tool) => tool.status === 'Confirming'),
),
[pendingHistoryItems],
);
const { elapsedTime, currentLoadingPhrase, shouldShowSpinner } =
useLoadingIndicator(streamingState, isPausedForConfirmation);
const showAutoAcceptIndicator = useAutoAcceptIndicator({ config });
const handleFinalSubmit = useCallback(
@@ -302,6 +311,7 @@ export const App = ({
key={h.id}
item={h}
isPending={false}
streamingState={streamingState}
/>
)),
]}
@@ -317,6 +327,7 @@ export const App = ({
// HistoryItemDisplay. Refactor later. Use a fake id for now.
item={{ ...item, id: 0 }}
isPending={true}
streamingState={streamingState}
/>
))}
</Box>
@@ -356,6 +367,7 @@ export const App = ({
<>
<LoadingIndicator
isLoading={streamingState === StreamingState.Responding}
showSpinner={shouldShowSpinner}
currentLoadingPhrase={currentLoadingPhrase}
elapsedTime={elapsedTime}
/>