滚动条

main
wangyunfei 1 month ago
parent 2301da2538
commit eb53daf45a

@ -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 = () => {

Loading…
Cancel
Save