diff --git a/app/components/home.tsx b/app/components/home.tsx index 8396438a..850c5177 100644 --- a/app/components/home.tsx +++ b/app/components/home.tsx @@ -131,10 +131,12 @@ function useSubmitHandler() { (config.submitKey === SubmitKey.AltEnter && e.altKey) || (config.submitKey === SubmitKey.CtrlEnter && e.ctrlKey) || (config.submitKey === SubmitKey.ShiftEnter && e.shiftKey) || + (config.submitKey === SubmitKey.MetaEnter && e.metaKey) || (config.submitKey === SubmitKey.Enter && !e.altKey && !e.ctrlKey && - !e.shiftKey) + !e.shiftKey && + !e.metaKey) ); }; @@ -163,6 +165,7 @@ export function Chat(props: { showSideBar?: () => void }) { setIsLoading(true); onUserInput(userInput).then(() => setIsLoading(false)); setUserInput(""); + inputRef.current?.focus(); }; // stop response @@ -203,6 +206,7 @@ export function Chat(props: { showSideBar?: () => void }) { // for auto-scroll const latestMessageRef = useRef(null); + const inputRef = useRef(null); // wont scroll while hovering messages const [autoScroll, setAutoScroll] = useState(false); @@ -371,6 +375,7 @@ export function Chat(props: { showSideBar?: () => void }) {