"use client" import { useState, useTransition } from "react" import { useAssistant } from "@/services/assistant/useAssistant" import { ChatBubble } from "./ChatBubble" import { Input } from "../ui/input" import { useTheme } from "@/services/ui/useTheme" export function ChatView() { const [_isPending, startTransition] = useTransition() const theme = useTheme() const [draft, setDraft] = useState("") const history = useAssistant((s) => s.history) const processMessage = useAssistant((s) => s.processMessage) const handleSubmit = () => { const message = draft.trim() if (!message) { return } setDraft("") processMessage(draft.trim()) } return (
{history.map(event => ( ))}
setDraft(e.target.value)} onKeyDown={({ key }) => { if (key === 'Enter') { handleSubmit() } }} />
) }