diff --git a/src/app/(app)/problems/[id]/@ai/@bot/page.tsx b/src/app/(app)/problems/[id]/@ai/@bot/page.tsx index fdfb994..4a21788 100644 --- a/src/app/(app)/problems/[id]/@ai/@bot/page.tsx +++ b/src/app/(app)/problems/[id]/@ai/@bot/page.tsx @@ -3,6 +3,7 @@ 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"; @@ -10,21 +11,32 @@ import { ChatMessageList } from "@/components/ui/chat/chat-message-list"; import { ChatBubble, ChatBubbleAvatar, ChatBubbleMessage } from "@/components/ui/chat/chat-bubble"; export default function AiBotPage() { - const { messages, input, handleInputChange, handleSubmit } = useChat(); + const { problemId, problem } = useProblem(); + const { messages, input, handleInputChange, handleSubmit } = useChat({ + initialMessages: [ + { + id: problemId, + role: "system", + content: `Problem description:\n${problem.description}`, + }, + ], + }); return (