diff --git a/web-app/src/containers/ThinkingBlock.tsx b/web-app/src/containers/ThinkingBlock.tsx index 63f72fa44..55b727ed5 100644 --- a/web-app/src/containers/ThinkingBlock.tsx +++ b/web-app/src/containers/ThinkingBlock.tsx @@ -83,7 +83,7 @@ const ThinkingBlock = ({ const handleImageClick = (url: string, alt: string) => setModalImage({ url, alt }) - // Actual loading state comes from prop, determined by whether final text started streaming (Req 2) + // Actual loading state comes from prop, determined by whether final text started streaming const loading = propLoading // Set default expansion state: collapsed if done (not loading). @@ -98,15 +98,11 @@ const ThinkingBlock = ({ const N = stepsWithoutDone.length // Determine the step to display in the condensed streaming view - // When loading, we show the last available step (N-1), which is currently accumulating content. const activeStep = useMemo(() => { if (!loading || N === 0) return null return stepsWithoutDone[N - 1] }, [loading, N, stepsWithoutDone]) - // Determine if the block is truly empty (streaming started but no content/steps yet) - const isStreamingEmpty = loading && N === 0 - // If not loading, and there are no steps, hide the block entirely. const hasContent = steps.length > 0 if (!loading && !hasContent) return null @@ -277,7 +273,6 @@ const ThinkingBlock = ({ return (
@@ -287,12 +282,11 @@ const ThinkingBlock = ({ )}
- {isStreamingEmpty && ( -
- - {t('chat:thinking')} - -
- )} - {/* Streaming/Condensed View - shows active step (N-1) */} - {loading && activeStep && ( + {/* This block handles both the N>0 case and the N=0 fallback, ensuring stability. */} + {loading && (activeStep || N === 0) && (
-
- {/* Bullet point/Icon position relative to line */} -
- {/* Active step content */} - {renderStepContent(activeStep, N - 1, handleImageClick, t)} -
+ {/* If N=0, just show the fallback text in the header and this area remains minimal. */} + {activeStep && ( +
+ {/* Bullet point/Icon position relative to line */} +
+ {/* Active step content */} + {renderStepContent(activeStep, N - 1, handleImageClick, t)} +
+ )}
)}