李富豪 пре 4 месеци
родитељ
комит
717ee81e58
1 измењених фајлова са 11 додато и 1 уклоњено
  1. 11 1
      app/components/chat.tsx

+ 11 - 1
app/components/chat.tsx

@@ -1759,6 +1759,17 @@ function _Chat() {
     )
   }
 
+  useEffect(() => {
+    // 当显示欢迎页面时,确保滚动到顶部
+    if (messages.length <= 1 && scrollRef.current) {
+      setTimeout(() => {
+        if (scrollRef.current) {
+          scrollRef.current.scrollTo(0, 0);
+        }
+      }, 0);
+    }
+  }, [messages.length]);
+
   return (
     <div className={styles.chat} key={session.id}>
       {
@@ -2182,7 +2193,6 @@ function _Chat() {
             </>
         }
       </div>
-
       <div className={styles["chat-input-panel"]}>
         {/* <PromptHints prompts={promptHints} onPromptSelect={onPromptSelect} /> */}
         <ChatActions