import { Bot, Sparkles, User } from 'lucide-react' import { useCallback, useEffect, useMemo, useRef } from 'react' import { useTranslation } from 'react-i18next' import { Avatar, AvatarFallback, AvatarImage } from '@/components/ui/avatar' import { ScrollArea } from '@/components/ui/scroll-area' import { cn } from '@/lib/utils' import { ChatScrollContext, type ChatScrollContextValue } from './ChatScrollContext' import { RenderMessageContent } from './MessageRenderer' import type { ChatMessage } from './types' interface MessageListProps { messages: ChatMessage[] isLoadingHistory: boolean botDisplayName: string /** 机器人 QQ 号;存在时会从 QQ 头像公开接口拉取头像作为 bot 头像。 */ botQq?: string userName: string language: string } interface BubbleAvatarProps { type: 'user' | 'bot' visible: boolean /** bot 头像 URL(可选);加载失败时自动 fallback 到默认 SVG 图标。 */ imageUrl?: string } function BubbleAvatar({ type, visible, imageUrl }: BubbleAvatarProps) { return (
{t('chat.message.emptyHint')}