Jan is an open source alternative to ChatGPT that runs 100% offline on your computer.
fix: Prevent accidental message submitting on ChatInput for users with IME input languages
B0sh9b8fb6279016
diff --git a/web-app/src/containers/ChatInput.tsx b/web-app/src/containers/ChatInput.tsxindex a2f4bb013..5268834b2 100644--- a/web-app/src/containers/ChatInput.tsx+++ b/web-app/src/containers/ChatInput.tsx@@ -371,7 +371,9 @@ const ChatInput = ({ model, className, initialMessage }: ChatInputProps) => {setRows(Math.min(newRows, maxRows))}}onKeyDown={(e) => {- if (e.key === 'Enter' && !e.shiftKey && prompt.trim()) {+ // e.keyCode 229 is for IME input with Safari+ const isComposing = e.nativeEvent.isComposing || e.keyCode === 229;+ if (e.key === 'Enter' && !e.shiftKey && prompt.trim() && !isComposing) {e.preventDefault()// Submit the message when Enter is pressed without ShifthandleSendMesage(prompt)