Pārlūkot izejas kodu

Merge pull request #565 from xiaotianxt/main

fix: distinguish PC/Mobile behavior on auto-scroll
Yifei Zhang 1 gadu atpakaļ
vecāks
revīzija
9a952f0e45
1 mainītis faili ar 2 papildinājumiem un 1 dzēšanām
  1. 2 1
      app/components/chat.tsx

+ 2 - 1
app/components/chat.tsx

@@ -421,6 +421,7 @@ export function Chat(props: {
   // check if should send message
   const onInputKeyDown = (e: React.KeyboardEvent<HTMLTextAreaElement>) => {
     if (shouldSubmit(e)) {
+      setAutoScroll(true);
       onUserSubmit();
       e.preventDefault();
     }
@@ -667,7 +668,7 @@ export function Chat(props: {
             onInput={(e) => onInput(e.currentTarget.value)}
             value={userInput}
             onKeyDown={onInputKeyDown}
-            onFocus={() => setAutoScroll(true)}
+            onFocus={() => setAutoScroll(isMobileScreen())}
             onBlur={() => {
               setAutoScroll(false);
               setTimeout(() => setPromptHints([]), 500);