From 8d8b6666b4a1acde896b6a290c0f2d7f954b4163 Mon Sep 17 00:00:00 2001 From: cfngc4594 Date: Mon, 24 Mar 2025 19:58:48 +0800 Subject: [PATCH] feat(playground): add AI chat interface for bot --- src/app/(app)/problems/[id]/@ai/@bot/page.tsx | 47 +++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 src/app/(app)/problems/[id]/@ai/@bot/page.tsx diff --git a/src/app/(app)/problems/[id]/@ai/@bot/page.tsx b/src/app/(app)/problems/[id]/@ai/@bot/page.tsx new file mode 100644 index 0000000..fdfb994 --- /dev/null +++ b/src/app/(app)/problems/[id]/@ai/@bot/page.tsx @@ -0,0 +1,47 @@ +"use client"; + +import { useChat } from "@ai-sdk/react"; +import { SendHorizonal } from "lucide-react"; +import { Button } from "@/components/ui/button"; +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 { messages, input, handleInputChange, handleSubmit } = useChat(); + + return ( +
+
+ + + {messages.map((message, index) => ( + + + + + + + ))} + + + +
+