import { useEffect, useState } from 'react'; export interface StreamingMessageProps { content: string; isStreaming?: boolean; className?: string; } export function StreamingMessage({ content, isStreaming = false, className = '' }: StreamingMessageProps) { const [displayedContent, setDisplayedContent] = useState(''); useEffect(() => { if (isStreaming) { // Update displayed content as it streams setDisplayedContent(content); } else { // When streaming stops, show final content setDisplayedContent(content); } }, [content, isStreaming]); return (

{displayedContent}

{isStreaming && ( )}
); }