import { Button } from "@/components/ui/button"; import { Textarea } from "@/components/ui/textarea"; import { Send, Square, Globe, WifiOff, ChevronUp } from "lucide-react"; import { useState, useRef, useEffect } from "react"; import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, } from "@/components/ui/tooltip"; interface ChatInputProps { onSend: (message: string) => void; onStop: () => void; isLoading: boolean; webSearchEnabled?: boolean; onWebSearchToggle?: (enabled: boolean) => void; categories?: SearchCategory[]; onToggleCategory?: (id: string, enabled: boolean) => void; } export function ChatInput({ onSend, onStop, isLoading, webSearchEnabled = true, onWebSearchToggle, categories = [], onToggleCategory, }: ChatInputProps) { const [input, setInput] = useState(""); const textareaRef = useRef(null); const [webDialogOpen, setWebDialogOpen] = useState(false); const handleKeyDown = (e: React.KeyboardEvent) => { if (e.key === "Enter" && !e.shiftKey) { e.preventDefault(); handleSend(); } }; const handleSend = () => { if (input.trim() && !isLoading) { onSend(input); setInput(""); } }; useEffect(() => { if (textareaRef.current) { textareaRef.current.style.height = "auto"; textareaRef.current.style.height = `${textareaRef.current.scrollHeight}px`; } }, [input]); return (