Skip to content

Commit

Permalink
fix: regenerate scroll bottom (#4348)
Browse files Browse the repository at this point in the history
  • Loading branch information
urmauur authored Dec 29, 2024
1 parent c77275a commit c0f3fb5
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions web/screens/Thread/ThreadCenterPanel/ChatBody/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -86,20 +86,23 @@ const ChatBody = memo(
})

useEffect(() => {
isUserManuallyScrollingUp.current = false
if (parentRef.current) {
parentRef.current.scrollTo({ top: parentRef.current.scrollHeight })
virtualizer.scrollToIndex(count - 1)
}
}, [count, virtualizer])

useEffect(() => {
isUserManuallyScrollingUp.current = false
if (parentRef.current && isGeneratingResponse) {
parentRef.current.scrollTo({ top: parentRef.current.scrollHeight })
virtualizer.scrollToIndex(count - 1)
}
}, [count, virtualizer, isGeneratingResponse])

useEffect(() => {
isUserManuallyScrollingUp.current = false
if (parentRef.current && isGeneratingResponse) {
parentRef.current.scrollTo({ top: parentRef.current.scrollHeight })
virtualizer.scrollToIndex(count - 1)
Expand Down

0 comments on commit c0f3fb5

Please sign in to comment.