"use client" import type React from "react" import { useState, useRef, type KeyboardEvent } from "react" import { Button } from "@/components/ui/button" import { Textarea } from "@/components/ui/textarea" import { Send, Trash2, Paperclip } from "lucide-react" interface ChatInputProps { onSend: (message: string, file?: File) => void isLoading: boolean onClear: () => void } export function ChatInput({ onSend, isLoading, onClear }: ChatInputProps) { const [message, setMessage] = useState("") const [file, setFile] = useState(null) const fileInputRef = useRef(null) const handleSend = () => { if (message.trim() || file) { onSend(message.trim(), file || undefined) setMessage("") setFile(null) } } const handleKeyPress = (e: KeyboardEvent) => { if (e.key === "Enter" && !e.shiftKey) { e.preventDefault() handleSend() } } const handleFileSelect = (e: React.ChangeEvent) => { const selectedFile = e.target.files?.[0] if (selectedFile) { setFile(selectedFile) } } return (
{file && (
{file.name}
)}