Skip to content

Commit 064af93

Browse files
don't scroll to top of response when done streaming
1 parent 0111c2c commit 064af93

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

ui/src/pages/RagChatTab/ChatOutput/ChatMessages/ChatMessageController.tsx

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -135,18 +135,26 @@ const ChatMessageController = () => {
135135
}
136136
}, [fetchPreviousPage, inView]);
137137

138+
useEffect(() => {
139+
if (bottomElement.current) {
140+
bottomElement.current.scrollIntoView({ behavior: "instant" });
141+
}
142+
}, [activeSession?.id]);
143+
138144
useEffect(() => {
139145
if (bottomElement.current) {
140146
if (
141147
flatChatHistory.length > 0 &&
142148
isPlaceholder(flatChatHistory[flatChatHistory.length - 1])
143149
) {
144-
bottomElement.current.scrollIntoView({ behavior: "smooth" });
150+
bottomElement.current.scrollIntoView({
151+
behavior: "smooth",
152+
});
145153
} else {
146-
bottomElement.current.scrollIntoView({ behavior: "auto" });
154+
bottomElement.current.scrollIntoView({ behavior: "instant" });
147155
}
148156
}
149-
}, [bottomElement.current, flatChatHistory.length, activeSession?.id]);
157+
}, [flatChatHistory.length]);
150158

151159
if (chatHistoryStatus === "pending") {
152160
return <ChatLoading />;

0 commit comments

Comments
 (0)