diff --git a/frontend/src/components/chat/chat-bottombar.tsx b/frontend/src/components/chat/chat-bottombar.tsx index 7435e9cd..213876e5 100644 --- a/frontend/src/components/chat/chat-bottombar.tsx +++ b/frontend/src/components/chat/chat-bottombar.tsx @@ -4,7 +4,7 @@ import { motion, AnimatePresence } from 'framer-motion'; import TextareaAutosize from 'react-textarea-autosize'; import { PaperclipIcon, Send, X } from 'lucide-react'; import { cn } from '@/lib/utils'; -import { ChatProps } from './chat-panel'; +import { Message } from '../../const/MessageType'; import Image from 'next/image'; import { Tooltip, @@ -13,6 +13,18 @@ import { TooltipTrigger, } from '@/components/ui/tooltip'; +interface ChatBottombarProps { + messages: Message[]; + input: string; + handleInputChange: (e: React.ChangeEvent) => void; + handleSubmit: (e: React.FormEvent) => void; + stop: () => void; + formRef: React.RefObject; + setInput?: React.Dispatch>; + setMessages: (messages: Message[]) => void; + setSelectedModel: React.Dispatch>; +} + export default function ChatBottombar({ messages, input, @@ -20,7 +32,9 @@ export default function ChatBottombar({ handleSubmit, formRef, setInput, -}: ChatProps) { + setMessages, + setSelectedModel, +}: ChatBottombarProps) { const [isMobile, setIsMobile] = useState(false); const [isFocused, setIsFocused] = useState(false); const [attachments, setAttachments] = useState([]); diff --git a/frontend/src/components/chat/chat-list.tsx b/frontend/src/components/chat/chat-list.tsx index e620538a..87ac3140 100644 --- a/frontend/src/components/chat/chat-list.tsx +++ b/frontend/src/components/chat/chat-list.tsx @@ -9,24 +9,40 @@ import remarkGfm from 'remark-gfm'; import CodeDisplayBlock from '../code-display-block'; import { Message } from '../../const/MessageType'; import { Button } from '../ui/button'; -import { Check, Pencil, X, Code, Terminal } from 'lucide-react'; +import { + Check, + Pencil, + X, + Code, + Copy, + Trash2, + RotateCcw, + ThumbsUp, + ThumbsDown, +} from 'lucide-react'; import { useAuthContext } from '@/providers/AuthProvider'; +import ThinkingProcessBlock from './thinking-process-block'; interface ChatListProps { messages: Message[]; loadingSubmit?: boolean; onMessageEdit?: (messageId: string, newContent: string) => void; + thinkingProcess?: Message[]; + + isTPUpdating: boolean; } const isUserMessage = (role: string) => role.toLowerCase() === 'user'; -const isToolCall = (content: string) => - content.includes('```') || content.includes('executing'); export default function ChatList({ messages, loadingSubmit, onMessageEdit, + thinkingProcess, + + isTPUpdating, }: ChatListProps) { + console.log(thinkingProcess); const bottomRef = useRef(null); const { user } = useAuthContext(); @@ -65,20 +81,26 @@ export default function ChatList({ }; const renderMessageContent = (content: string) => { - return content.split('```').map((part, index) => { - if (index % 2 === 0) { - return ( - - {part} - - ); - } - return ( -
- -
- ); - }); + return ( + + ) : ( + + {children} + + ); + }, + }} + > + {content} + + ); }; if (messages.length === 0) { @@ -112,7 +134,6 @@ export default function ChatList({ {messages.map((message, index) => { const isUser = isUserMessage(message.role); const isEditing = message.id === editingMessageId; - const isTool = !isUser && isToolCall(message.content); return ( - {/* Sender info - always on the left */} -
+
)} - - {isUser ? user.username || 'You' : 'CodeFox'} -
- {/* Message content */} -
- {/* Edit buttons for user messages */} - {isUser && !isEditing && onMessageEdit && ( - - )} - - {/* Message bubble */} +
{isEditing ? ( -
-