import { marked } from "marked"; import DOMPurify from "dompurify"; import { useEffect } from "react"; import BotIcon from "./icons/BotIcon"; import UserIcon from "./icons/UserIcon"; import "../styles/Chat.css"; function render(text) { return DOMPurify.sanitize(marked.parse(text)); } /** * Chat component renders a chat interface with messages. */ export default function Chat({ messages }) { const empty = messages.length === 0; useEffect(() => { window.MathJax.typeset(); }, [messages]); return (
{msg.content.length > 0 ? ( ) : ( )}
{msg.content}