- {!isStreaming && !effectiveIsExpanded && summary ? (
+ {!isStreaming && !isExpanded && summary ? (
= ({
@@ -377,19 +367,22 @@ type ReasoningPartProps = {
part: Part;
onContentChange?: (reason?: ContentChangeReason) => void;
messageId: string;
+ streamPhase?: StreamPhase;
};
const ReasoningPart = React.memo(({
part,
onContentChange,
messageId,
+ streamPhase,
}: ReasoningPartProps) => {
const chatRenderMode = useUIStore((state) => state.chatRenderMode);
const partWithText = part as PartWithText;
const rawText = partWithText.text || partWithText.content || '';
const textContent = React.useMemo(() => cleanReasoningText(rawText), [rawText]);
const time = partWithText.time;
- const isStreaming = chatRenderMode === 'live' && typeof time?.end !== 'number';
+ const canBeStreaming = streamPhase === undefined || streamPhase !== 'completed';
+ const isStreaming = chatRenderMode === 'live' && canBeStreaming && typeof time?.end !== 'number';
const throttledText = useStreamingTextThrottle({
text: textContent,
isStreaming,
@@ -418,6 +411,7 @@ type MergedReasoningPartProps = {
parts: Part[];
onContentChange?: (reason?: ContentChangeReason) => void;
messageId: string;
+ streamPhase?: StreamPhase;
};
/**
@@ -429,6 +423,7 @@ export const MergedReasoningPart = React.memo(({
parts,
onContentChange,
messageId,
+ streamPhase,
}: MergedReasoningPartProps) => {
const chatRenderMode = useUIStore((state) => state.chatRenderMode);
@@ -463,7 +458,8 @@ export const MergedReasoningPart = React.memo(({
return earliestStart !== undefined ? { start: earliestStart, end: latestEnd } : undefined;
}, [parts]);
- const isStreaming = chatRenderMode === 'live' && parts.some(
+ const canBeStreaming = streamPhase === undefined || streamPhase !== 'completed';
+ const isStreaming = chatRenderMode === 'live' && canBeStreaming && parts.some(
(part) => typeof (part as PartWithText).time?.end !== 'number',
);