import { useState } from 'react' import { useChat } from '../context/ChatContext' import MessageList from './MessageList' import ChatInput from './ChatInput' import { AlertCircle, X } from 'lucide-react' export default function ChatView() { const { envelope, isLive, isLoading, sendMessage, error, clearError } = useChat() const [input, setInput] = useState('') const handleSend = () => { if (!input.trim() || isLoading) return sendMessage(input.trim()) setInput('') } return (
{/* 错误提示条 */} {error && (
{error}
)}
) }