fix: regenerate scroll bottom (#4348)

This commit is contained in:
Faisal Amir 2024-12-29 21:58:46 +08:00 committed by GitHub
parent c77275a35c
commit c0f3fb5007
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -86,6 +86,7 @@ const ChatBody = memo(
})
useEffect(() => {
isUserManuallyScrollingUp.current = false
if (parentRef.current) {
parentRef.current.scrollTo({ top: parentRef.current.scrollHeight })
virtualizer.scrollToIndex(count - 1)
@ -93,6 +94,7 @@ const ChatBody = memo(
}, [count, virtualizer])
useEffect(() => {
isUserManuallyScrollingUp.current = false
if (parentRef.current && isGeneratingResponse) {
parentRef.current.scrollTo({ top: parentRef.current.scrollHeight })
virtualizer.scrollToIndex(count - 1)
@ -100,6 +102,7 @@ const ChatBody = memo(
}, [count, virtualizer, isGeneratingResponse])
useEffect(() => {
isUserManuallyScrollingUp.current = false
if (parentRef.current && isGeneratingResponse) {
parentRef.current.scrollTo({ top: parentRef.current.scrollHeight })
virtualizer.scrollToIndex(count - 1)