import React from 'react'; import { ChatMessage } from '@/types.ts'; import { useTranslation } from '@/hooks/useI18n.tsx'; import TypingIndicator from '@/components/chatbot/TypingIndicator.tsx'; import MarkdownRenderer from '@/components/chatbot/MarkdownRenderer.tsx'; import Button from '@/components/ui/Button.tsx'; import { Check, Copy } from 'lucide-react'; interface ChatHistoryProps { messages: ChatMessage[]; messagesEndRef: React.RefObject; copiedText: string | null; onCopy: (text: string) => void; } const ChatHistory = ({ messages, messagesEndRef, copiedText, onCopy }: ChatHistoryProps) => { const { t } = useTranslation(); return (
{messages.map((msg) => (
{msg.role === 'model' && (
{t('chatbot.aiAcronym')}
)}
{msg.imageUrl && (
Chat image { (e.target as HTMLImageElement).style.display = 'none'; }} />
)} {msg.isLoading ? : }
{msg.role === 'model' && !msg.isLoading && msg.text && ( )}
))}
); }; export default React.memo(ChatHistory);