From 8466355f590b5d143627bc4126071ceeaac8a2ab Mon Sep 17 00:00:00 2001 From: phact Date: Mon, 21 Jul 2025 12:49:26 -0400 Subject: [PATCH] auto focus --- frontend/src/app/chat/page.tsx | 7 +++++++ 1 file changed, 7 insertions(+) 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..."