diff --git a/src/app/(app)/problems/[id]/@Bot/layout.tsx b/src/app/(app)/problems/[id]/@Bot/layout.tsx deleted file mode 100644 index 675be62..0000000 --- a/src/app/(app)/problems/[id]/@Bot/layout.tsx +++ /dev/null @@ -1,15 +0,0 @@ -interface BotLayoutProps { - children: React.ReactNode; -} - -export default function BotLayout({ - children, -}: BotLayoutProps) { - return ( -
-
- {children} -
-
- ); -} diff --git a/src/app/(app)/problems/[id]/@Bot/page.tsx b/src/app/(app)/problems/[id]/@Bot/page.tsx deleted file mode 100644 index 6f40c81..0000000 --- a/src/app/(app)/problems/[id]/@Bot/page.tsx +++ /dev/null @@ -1,110 +0,0 @@ -"use client"; - -import { toast } from "sonner"; -import { useCallback } from "react"; -import { useChat } from "@ai-sdk/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 { BotIcon, SendHorizonal } from "lucide-react"; -import { ScrollArea, ScrollBar } from "@/components/ui/scroll-area"; -import { ChatMessageList } from "@/components/ui/chat/chat-message-list"; -import { ChatBubble, ChatBubbleMessage } from "@/components/ui/chat/chat-bubble"; -import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "@/components/ui/tooltip"; - -export default function AiBotPage() { - const { problemId, problem, currentLang, currentValue } = useProblem(); - const { messages, input, handleInputChange, setMessages, handleSubmit } = useChat({ - initialMessages: [ - { - id: problemId, - role: "system", - content: `Problem description:\n${problem.description}`, - }, - ], - }); - - const handleFormSubmit = useCallback( - (e: React.FormEvent) => { - e.preventDefault(); - if (!input.trim()) { - toast.error("Input cannot be empty"); - return; - } - - const currentCodeMessage = { - id: problemId, - role: "system" as const, - content: `Current code:\n\`\`\`${currentLang}\n${currentValue}\n\`\`\``, - }; - - setMessages((prev) => [...prev, currentCodeMessage]); - handleSubmit(); - }, - [currentLang, currentValue, handleSubmit, input, problemId, setMessages] - ); - - return ( -
-
- {!messages.some((message) => message.role === "user" || message.role === "assistant") && ( -
- - Ask Bot - Powered by Vercel Ai SDK -
- )} - - - {messages - .filter((message) => message.role === "user" || message.role === "assistant") - .map((message) => ( - - - - - - ))} - - - -
-