diff --git a/src/app/(app)/problems/[id]/features/bot.tsx b/src/app/(app)/problems/[id]/features/bot.tsx index 70f7f02..c81eb25 100644 --- a/src/app/(app)/problems/[id]/features/bot.tsx +++ b/src/app/(app)/problems/[id]/features/bot.tsx @@ -14,12 +14,13 @@ 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 { ScrollArea } from "@/components/ui/scroll-area"; import { ChatMessageList } from "@/components/ui/chat/chat-message-list"; import { ChatBubble, ChatBubbleMessage } from "@/components/ui/chat/chat-bubble"; export default function Bot() { const { problemId, problem, currentLang, currentValue } = useProblem(); + const { messages, input, handleInputChange, setMessages, handleSubmit } = useChat({ initialMessages: [ { @@ -33,6 +34,7 @@ export default function Bot() { const handleFormSubmit = useCallback( (e: React.FormEvent) => { e.preventDefault(); + if (!input.trim()) { toast.error("Input cannot be empty"); return; @@ -52,72 +54,72 @@ export default function Bot() { return (