diff --git a/frontend/src/app/chat/page.tsx b/frontend/src/app/chat/page.tsx index f646fe0c..cf1ebde1 100644 --- a/frontend/src/app/chat/page.tsx +++ b/frontend/src/app/chat/page.tsx @@ -44,6 +44,7 @@ export default function ChatPage() { const [isDragOver, setIsDragOver] = useState(false) const dragCounterRef = useRef(0) const messagesEndRef = useRef(null) + const inputRef = useRef(null) const scrollToBottom = () => { messagesEndRef.current?.scrollIntoView({ behavior: "smooth" }) @@ -152,6 +153,11 @@ export default function ChatPage() { scrollToBottom() }, [messages, streamingMessage]) + // Auto-focus the input on component mount + useEffect(() => { + inputRef.current?.focus() + }, []) + const handleSSEStream = async (userMessage: Message) => { const apiEndpoint = endpoint === "chat" ? "/api/chat" : "/api/langflow" @@ -843,6 +849,7 @@ export default function ChatPage() { {/* Input Area */}
setInput(e.target.value)} placeholder="Ask a question about your documents..."