import { useRef, useState, type KeyboardEvent } from "react"; import { ArrowUp, Square } from "lucide-react"; import { cn } from "@/lib/utils"; export function ChatInput({ onSend, onStop, busy, disabled, placeholder, }: { onSend: (text: string) => void; onStop?: () => void; busy?: boolean; disabled?: boolean; placeholder?: string; }) { const [text, setText] = useState(""); const ref = useRef(null); const submit = () => { const t = text.trim(); if (!t || busy || disabled) return; onSend(t); setText(""); if (ref.current) ref.current.style.height = "auto"; }; const onKey = (e: KeyboardEvent) => { if (e.key === "Enter" && !e.shiftKey) { e.preventDefault(); submit(); } }; return (