import { useState, useRef, useEffect, useCallback } from 'react'; import ReactMarkdown from 'react-markdown'; import remarkGfm from 'remark-gfm'; import { Prism as SyntaxHighlighter } from 'react-syntax-highlighter'; import { vscDarkPlus } from 'react-syntax-highlighter/dist/esm/styles/prism'; import { Send, Square, Bot, User, Copy, Check, Menu, Sparkles, RefreshCw, } from 'lucide-react'; import type { Conversation, Message } from '@/types'; interface ChatAreaProps { conversation: Conversation | null; isStreaming: boolean; onSendMessage: (content: string) => void; onRegenerateMessage: (messageId: string) => void; onStopStreaming: () => void; sidebarOpen: boolean; onToggleSidebar: () => void; } function CodeBlock({ language, value }: { language: string; value: string }) { const [copied, setCopied] = useState(false); const handleCopy = async () => { await navigator.clipboard.writeText(value); setCopied(true); setTimeout(() => setCopied(false), 2000); }; return (
{message.content}
{children}
);
},
p({ children }) {
return {children}
; }, ul({ children }) { return{children}); }, table({ children }) { return (
{conversation.modelConfig.model} · temp: {conversation.modelConfig.temperature}
)}开始一段新的对话
在下方输入框中输入你的问题
自托管大模型控制台 · API 调用在浏览器端完成