diff --git a/components/chat-input.tsx b/components/chat-input.tsx index f764b6b..ac9f805 100644 --- a/components/chat-input.tsx +++ b/components/chat-input.tsx @@ -7,12 +7,12 @@ import { Loader2, Send } from "lucide-react" interface ChatInputProps { input: string - isLoading: boolean + status: "submitted" | "streaming" | "ready" | "error" onSubmit: (e: React.FormEvent) => void onChange: (e: React.ChangeEvent) => void } -export function ChatInput({ input, isLoading, onSubmit, onChange }: ChatInputProps) { +export function ChatInput({ input, status, onSubmit, onChange }: ChatInputProps) { const textareaRef = useRef(null) // Auto-resize textarea based on content @@ -33,7 +33,7 @@ export function ChatInput({ input, isLoading, onSubmit, onChange }: ChatInputPro if ((e.metaKey || e.ctrlKey) && e.key === "Enter") { e.preventDefault() const form = e.currentTarget.closest("form") - if (form && input.trim() && !isLoading) { + if (form && input.trim() && status !== "streaming") { form.requestSubmit() } } @@ -47,18 +47,18 @@ export function ChatInput({ input, isLoading, onSubmit, onChange }: ChatInputPro onChange={onChange} onKeyDown={handleKeyDown} placeholder="Describe what changes you want to make to the diagram... (Press Cmd/Ctrl + Enter to send)" - disabled={isLoading} + disabled={status === "streaming"} aria-label="Chat input" className="min-h-[80px] resize-none transition-all duration-200" />