diff --git a/app/components/home.tsx b/app/components/home.tsx index 9d20c32c..850c5177 100644 --- a/app/components/home.tsx +++ b/app/components/home.tsx @@ -165,6 +165,7 @@ export function Chat(props: { showSideBar?: () => void }) { setIsLoading(true); onUserInput(userInput).then(() => setIsLoading(false)); setUserInput(""); + inputRef.current?.focus(); }; // stop response @@ -205,21 +206,10 @@ export function Chat(props: { showSideBar?: () => void }) { // for auto-scroll const latestMessageRef = useRef(null); - const inputPanelRef = useRef(null); + const inputRef = useRef(null); // wont scroll while hovering messages const [autoScroll, setAutoScroll] = useState(false); - useEffect(() => { - const handleMouseDown = (e: MouseEvent) => { - // check if click on input panel - setAutoScroll( - !!inputPanelRef.current && - inputPanelRef.current.contains(e.target as HTMLElement) - ); - }; - document.addEventListener("mousedown", handleMouseDown); - return () => document.removeEventListener("mousedown", handleMouseDown); - }); // preview messages const messages = (session.messages as RenderMessage[]) @@ -382,15 +372,18 @@ export function Chat(props: { showSideBar?: () => void }) { -
+