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
fix: use onCompositionStart and onCompositionEnd to aviod enter submit when using input method.
Wentao Lyu2afbc5883f80
diff --git a/client/src/components/Main/TextChat.jsx b/client/src/components/Main/TextChat.jsxindex 1fb3b06d68..50b80b3b74 100644--- a/client/src/components/Main/TextChat.jsx+++ b/client/src/components/Main/TextChat.jsx@@ -17,6 +17,7 @@ import manualSWR from '~/utils/fetchers';export default function TextChat({ messages }) {const [errorMessage, setErrorMessage] = useState('');const inputRef = useRef(null)+ const isComposing = useRef(false);const dispatch = useDispatch();const convo = useSelector((state) => state.convo);const { initial } = useSelector((state) => state.models);@@ -278,6 +279,11 @@ export default function TextChat({ messages }) {if (e.key === 'Enter' && !e.shiftKey) {e.preventDefault();}++ if (e.key === 'Enter' && !e.shiftKey) {+ if (!isComposing.current)+ submitMessage();+ }};const handleKeyUp = (e) => {@@ -288,11 +294,15 @@ export default function TextChat({ messages }) {if (isSubmitting) {return;}-- if (e.key === 'Enter' && !e.shiftKey) {- submitMessage();- }};++ const handleCompositionStart = (e) => {+ isComposing.current = true+ }++ const handleCompositionEnd = (e) => {+ isComposing.current = false;+ }const changeHandler = (e) => {const { value } = e.target;@@ -337,6 +347,8 @@ export default function TextChat({ messages }) {onKeyUp={handleKeyUp}onKeyDown={handleKeyDown}onChange={changeHandler}+ onCompositionStart={handleCompositionStart}+ onCompositionEnd={handleCompositionEnd}placeholder={disabled ? 'Choose another model or customize GPT again' : ''}disabled={disabled}className="m-0 h-auto max-h-52 resize-none overflow-auto border-0 bg-transparent p-0 pl-9 pr-8 leading-6 focus:outline-none focus:ring-0 focus-visible:ring-0 dark:bg-transparent md:pl-8"