diff --git a/packages/ui/src/components/chat/message/MessageBody.tsx b/packages/ui/src/components/chat/message/MessageBody.tsx index dc08b74c..cfc228e6 100644 --- a/packages/ui/src/components/chat/message/MessageBody.tsx +++ b/packages/ui/src/components/chat/message/MessageBody.tsx @@ -327,6 +327,7 @@ const AssistantMessageBody: React.FC> = ({ return parts.some((part) => part.type === 'step-finish' && (part as { reason?: string | null | undefined }).reason === 'stop'); }, [parts]); + const hasTools = toolParts.length > 0; const hasPendingTools = React.useMemo(() => { @@ -961,13 +962,74 @@ const AssistantMessageBody: React.FC> = ({ const summaryBody = summaryBodyRef.current; const showSummaryBody = - turnGroupingContext?.isFirstAssistantInTurn && + turnGroupingContext?.isLastAssistantInTurn && summaryBody && summaryBody.trim().length > 0; const shouldShowFooter = hasTextContent && assistantTextParts.length > 0 && hasStopFinish && isLastAssistantInTurn; + const [isSummaryHovered, setIsSummaryHovered] = React.useState(false); + + const footerButtons = ( + <> + {onCopyMessage && ( + + + + + Copy answer + + )} + + + + + Start new session from this answer + + + ); + + return ( - return (
> = ({ }} onTouchStart={isTouchContext && canCopyMessage && hasCopyableText ? revealCopyHint : undefined} > -
-
+
+
{renderedParts} {showSummaryBody && ( -
- +
setIsSummaryHovered(true)} + onMouseLeave={() => setIsSummaryHovered(false)} + > + + {shouldShowFooter && ( +
+ {footerButtons} +
+ )}
)}
- {shouldShowFooter && ( -
- {onCopyMessage && ( - - - - - Copy answer - - )} - - - - - Start new session from this answer - + {!showSummaryBody && shouldShowFooter && ( +
+ {footerButtons}
)} +
);