import React, { useEffect, useRef } from 'react'; import { marked } from 'marked'; interface ChatContainerProps { currentChat: { messages: Array<{ content: string; isUser: boolean }>; thinkingSections: Array<{ thoughts: Array<{ type: string; content: string; details?: string }> }>; } | null; socket: any; } const ChatContainer: React.FC = ({ currentChat, socket }) => { const chatContainerRef = useRef(null); useEffect(() => { if (chatContainerRef.current) { chatContainerRef.current.scrollTop = chatContainerRef.current.scrollHeight; } }, [currentChat]); if (!currentChat) return null; return (
{currentChat.messages.map((message, index) => (
{message.isUser ? ( message.content ) : (
)}
))} {currentChat.thinkingSections.map((section, sectionIndex) => (
{section.thoughts.map((thought, thoughtIndex) => (
{thought.type}:
{thought.details && (
                  {thought.details}
                
)}
))}
))}
); }; function getThoughtColor(type: string): string { switch (type.toLowerCase()) { case 'plan': return 'text-blue-400'; case 'decision': return 'text-green-400'; case 'tool_call': return 'text-yellow-400'; case 'tool_result': return 'text-purple-400'; case 'think_more': return 'text-pink-400'; case 'answer': return 'text-red-400'; default: return 'text-gray-400'; } } export default ChatContainer;