import { useState, useEffect, memo } from 'react'; import { User, Bot, Wrench, CheckCircle, AlertCircle, Terminal, File, Image, FileText, Music, Video, Download, ChevronDown, ChevronRight, Copy, Check, Loader2, XCircle, Clock, Loader, X, Brain, Maximize2, } from 'lucide-react'; import ReactMarkdown from 'react-markdown'; import remarkGfm from 'remark-gfm'; import type { ChatMessage, Attachment, TaskToolResult } from '../../types/protocol'; import { ToolDetailModal } from './ToolDetailModal'; // 状态图标组件 function StatusIcon({ status, size = 14, }: { status: string; size?: number; }) { const iconClass = `transition-all duration-300`; switch (status) { case 'calling': case 'running': return ( ); case 'result': case 'success': case 'completed': return ( ); case 'failed': return ( ); case 'timeout': return ( ); case 'pending': case 'interrupted': case 'cancelled': return ( ); default: return null; } } interface MessageBubbleProps { message: ChatMessage; onNavigateToSubAgent?: (taskId: string, description: string, subagentType?: string) => void; showThinking?: boolean; } function getAttachmentIcon(mediaType: string) { switch (mediaType) { case 'image': return ; case 'audio': return ; case 'video': return