import React from "react"; import { Button } from "@/components/ui/button"; import { ClipboardCopy } from "lucide-react"; import { toast } from "sonner"; import { MessageProps } from "../types"; import ReactMarkdown from "react-markdown"; import { Prism as SyntaxHighlighter } from "react-syntax-highlighter"; import { oneDark } from "react-syntax-highlighter/dist/esm/styles/prism"; import remarkMath from "remark-math"; import rehypeKatex from "rehype-katex"; import remarkGfm from "remark-gfm"; import { Badge } from "@/components/ui/badge"; import "katex/dist/katex.min.css"; export const AIMessageComponent = React.memo(({ message }: MessageProps) => { const handleCopy = React.useCallback(() => { const content = String(message.content); navigator.clipboard.writeText(content) .then(() => toast.success("Response copied to clipboard")) .catch(() => toast.error("Failed to copy response")); }, [message.content]); return (
{children}
);
},
a(props) {
return ;
},
table(props) {
return