import useLLM from "@react-llm/headless"; import { useEffect, useRef } from "react"; import { MemoizedReactMarkdown } from './Markdown' import { CodeBlock } from './CodeBlock' function MessageList({ fileMode }) { const scrollRef = useRef(null); const { conversation, userRoleName } = useLLM(); const messages = conversation?.messages || []; const scrollToBottom = () => { if (scrollRef.current) { scrollRef.current.scrollIntoView(); } }; useEffect(() => { scrollToBottom(); }, [conversation, messages.length]); return (
{conversation?.messages.map((m) => (
▍ } children[0] = (children[0]).replace("`▍`", "▍") } const match = /language-(\w+)/.exec(className || ''); return !inline ? ( ) : ( {children} ); }, table({ children }) { return ( {children}
); }, th({ children }) { return ( {children} ); }, td({ children }) { return ( {children} ); }, }} > {m.text}
))}
); } export default MessageList;