"use client"; import { useState, type KeyboardEvent } from "react"; import { useTranslations } from "next-intl"; import { ArrowUp } from "lucide-react"; import { Button, Textarea } from "../../../../shadcnui"; interface Props { onSend: (content: string) => Promise; disabled?: boolean; value?: string; onValueChange?: (v: string) => void; } export function AssistantComposer({ onSend, disabled, value: controlled, onValueChange }: Props) { const t = useTranslations(); const [internal, setInternal] = useState(""); const value = controlled ?? internal; const setValue = onValueChange ?? setInternal; const canSend = value.trim().length > 0 && !disabled; const submit = async () => { if (!canSend) return; const payload = value.trim(); setValue(""); await onSend(payload); }; const onKeyDown = (e: KeyboardEvent) => { if (e.key === "Enter" && !e.shiftKey) { e.preventDefault(); void submit(); } }; return (