mirror of
https://github.com/logancyang/obsidian-copilot.git
synced 2026-07-22 07:50:24 +00:00
Only scroll to bottom when user messages are added (#1788)
This commit is contained in:
parent
9239dab78a
commit
bb8bbcb5d1
1 changed files with 8 additions and 3 deletions
|
|
@ -136,10 +136,15 @@ export const useChatScrolling = ({
|
|||
scrollToBottom("instant");
|
||||
}, [scrollToBottom]);
|
||||
|
||||
// Scroll to bottom when new messages are added
|
||||
// Scroll to bottom only when user messages are added (not AI messages)
|
||||
useEffect(() => {
|
||||
scrollToBottom();
|
||||
}, [chatHistory.length, scrollToBottom]);
|
||||
if (chatHistory.length > 0) {
|
||||
const lastMessage = chatHistory[chatHistory.length - 1];
|
||||
if (lastMessage && lastMessage.sender === USER_SENDER) {
|
||||
scrollToBottom();
|
||||
}
|
||||
}
|
||||
}, [chatHistory.length, chatHistory, scrollToBottom]);
|
||||
|
||||
return {
|
||||
containerMinHeight,
|
||||
|
|
|
|||
Loading…
Reference in a new issue