import React from 'react' import ReactMarkdown from 'react-markdown' import { Button } from '@/components/ui/button' import { Textarea } from '@/components/ui/textarea' import { Card } from '@/components/ui/card' import { Badge } from '@/components/ui/badge' import { Message } from '@/types/chat' import { Send, Square, Eye, EyeOff, Brain, User, Bot } from 'lucide-react' interface ChatContainerProps { messages: Message[] input: string setInput: (value: string) => void onSubmit: () => void onStop: () => void isLoading: boolean disabled?: boolean placeholder?: string } export function ChatContainer({ messages, input, setInput, onSubmit, onStop, isLoading, disabled = false, placeholder = "Type your message..." }: ChatContainerProps) { const [showThinking, setShowThinking] = React.useState<{ [key: string]: boolean }>({}) const handleKeyPress = (e: React.KeyboardEvent) => { if (e.key === 'Enter' && !e.shiftKey) { e.preventDefault() if (!isLoading && !disabled) { onSubmit() } } } const toggleThinking = (messageId: string) => { setShowThinking(prev => ({ ...prev, [messageId]: !prev[messageId] })) } return (
{/* Messages */}
{messages.length === 0 ? (

Start a conversation

Ask me anything and I'll help you out!

) : ( messages.map((message) => (
{message.role !== 'user' && (
)}
{message.role === 'user' ? ( ) : ( )} {message.role === 'user' ? 'You' : 'Assistant'} {message.model_used && ( {message.model_used} )}
{/* Thinking content */} {message.thinking_content && message.supports_thinking && (
{showThinking[message.id] && (
Thinking process:

{children}

}} > {message.thinking_content}
)}
)} {/* Main content */}

{children}

}} > {message.content}
{message.role === 'user' && (
)}
)) )}
{/* Input area */}