diff --git a/src/pages/chatConversation/ChatConversation.js b/src/pages/chatConversation/ChatConversation.js index c71b0d9..ee29865 100644 --- a/src/pages/chatConversation/ChatConversation.js +++ b/src/pages/chatConversation/ChatConversation.js @@ -61,13 +61,13 @@ function ChatConversation() { // 获取当前会话 const currentConversation = conversations.find(conv => conv.id === currentConversationId) const currentMessages = currentConversation?.messages || [] - // 自动滚动到底部 + // 自动滚动到底部 - 禁用 const chatScrollRef = useRef(null); - useEffect(() => { - if (chatScrollRef.current) { - chatScrollRef.current.scrollTop = chatScrollRef.current.scrollHeight; - } - }, [currentMessages, loading]); // currentMessages 是你的消息数组 + // useEffect(() => { + // if (chatScrollRef.current) { + // chatScrollRef.current.scrollTop = chatScrollRef.current.scrollHeight; + // } + // }, [currentMessages, loading]); // currentMessages 是你的消息数组 const scrollToBottom = () => { messagesEndRef.current?.scrollIntoView({ behavior: "smooth" }) @@ -138,9 +138,9 @@ function ChatConversation() { } }, []) - useEffect(() => { - scrollToBottom() - }, [currentMessages]) + // useEffect(() => { + // scrollToBottom() + // }, [currentMessages]) // 创建新对话 const createNewConversation = () => {