"use client"; import { useChat } from "@ai-sdk/react"; import { SendHorizonal } from "lucide-react"; import { Button } from "@/components/ui/button"; import { useProblem } from "@/hooks/use-problem"; import MdxPreview from "@/components/mdx-preview"; import { Textarea } from "@/components/ui/textarea"; import { ScrollArea, ScrollBar } from "@/components/ui/scroll-area"; import { ChatMessageList } from "@/components/ui/chat/chat-message-list"; import { ChatBubble, ChatBubbleAvatar, ChatBubbleMessage } from "@/components/ui/chat/chat-bubble"; export default function AiBotPage() { const { problemId, problem } = useProblem(); const { messages, input, handleInputChange, handleSubmit } = useChat({ initialMessages: [ { id: problemId, role: "system", content: `Problem description:\n${problem.description}`, }, ], }); return (
{messages .filter((message) => message.role === "user" || message.role === "assistant") .map((message, index) => ( ))}