import React, { useEffect, useRef } from 'react'; import ReactMarkdown from 'react-markdown'; import { Prism as SyntaxHighlighter } from 'react-syntax-highlighter'; import { atomDark } from 'react-syntax-highlighter/dist/esm/styles/prism'; import remarkGfm from 'remark-gfm'; import rehypeRaw from 'rehype-raw'; import './Streaming.css'; // Streaming component for rendering markdown content const Streaming = ({ content, isStreaming, onContentRef }) => { const contentRef = useRef(null); useEffect(() => { if (contentRef.current && onContentRef) { onContentRef(contentRef.current); } }, [content, onContentRef]); const displayContent = isStreaming ? `${content}▌` : (content || ''); return (
{children}
);
},
table({node, ...props}) {
return (