Enhanced ChatGPT Clone: Features Agents, MCP, Skills, DeepSeek, Anthropic, AWS, OpenAI, Responses API, Azure, Groq, o1, GPT-5, Mistral, OpenRouter, Vertex AI, Gemini, Artifacts, AI model switching, message search, Code Interpreter, langchain, DALL-E-3, OpenAPI Actions, Functions, Secure Multi-User Auth, Presets, open-source for self-hosting. Active
TypeScript aianthropicartifactsawsazurechatgptchatgpt-cloneclaudeclonedeepseekgeminigooglegpt-5librechatmcpo1openairesponses-apivisionwebui
feat: auto focus
Wentao Lyu8affbfdb4aed
diff --git a/client/src/components/Main/TextChat.jsx b/client/src/components/Main/TextChat.jsxindex 41c9d35b5c..12efc7c123 100644--- a/client/src/components/Main/TextChat.jsx+++ b/client/src/components/Main/TextChat.jsx@@ -1,4 +1,4 @@-import React, { useEffect, useState } from 'react';+import React, { useEffect, useRef, useState } from 'react';import { SSE } from '~/utils/sse';import SubmitButton from './SubmitButton';import Regenerate from './Regenerate';@@ -14,6 +14,7 @@ import { setText } from '~/store/textSlice';export default function TextChat({ messages }) {const [errorMessage, setErrorMessage] = useState('');+ const inputRef = useRef(null)const dispatch = useDispatch();const convo = useSelector((state) => state.convo);const { initial } = useSelector((state) => state.models);@@ -22,6 +23,11 @@ export default function TextChat({ messages }) {const { text } = useSelector((state) => state.text);const { error } = convo;+ // auto focus to input, when enter a conversation.+ useEffect(() => {+ inputRef.current?.focus();+ }, [convo?.conversationId, ])+const messageHandler = (data, currentState) => {const { messages, currentMsg, sender } = currentState;dispatch(setMessages([...messages, currentMsg, { sender, text: data }]));@@ -282,6 +288,8 @@ export default function TextChat({ messages }) {<ModelMenu /><TextareaAutosizetabIndex="0"+ autoFocus+ ref={inputRef}// style={{maxHeight: '200px', height: '24px', overflowY: 'hidden'}}rows="1"value={text}