Co-Authored-By: Classic298 <27028174+Classic298@users.noreply.github.com>
This commit is contained in:
Timothy Jaeryang Baek
2026-02-22 15:22:53 -06:00
parent 2beeeb90c2
commit 1f474187a7
4 changed files with 9 additions and 13 deletions

View File

@@ -356,9 +356,7 @@
}
};
const showMessage = async (message, ignoreSettings = false) => {
await tick();
const showMessage = async (message, scroll = true) => {
const _chatId = JSON.parse(JSON.stringify($chatId));
let _messageId = JSON.parse(JSON.stringify(message.id));
@@ -378,18 +376,19 @@
history.currentId = _messageId;
await tick();
await tick();
await tick();
if (($settings?.scrollOnBranchChange ?? true) || ignoreSettings) {
if (($settings?.scrollOnBranchChange ?? true) && scroll) {
const messageElement = document.getElementById(`message-${message.id}`);
if (messageElement) {
messageElement.scrollIntoView({ behavior: 'smooth' });
messageElement.scrollIntoView({ behavior: 'smooth', block: 'start' });
}
}
await tick();
await tick();
await tick();
saveChatHandler(_chatId, history);
};

View File

@@ -392,12 +392,7 @@
delete history.messages[id];
});
await tick();
showMessage({ id: parentMessageId });
// Update the chat
await updateChat();
showMessage({ id: parentMessageId }, false);
};
const triggerScroll = () => {

View File

@@ -612,6 +612,7 @@
class=" flex w-full message-{message.id}"
id="message-{message.id}"
dir={$settings.chatDirection}
style="scroll-margin-top: 3rem;"
>
<div class={`shrink-0 ltr:mr-3 rtl:ml-3 hidden @lg:flex mt-1 `}>
<ProfileImage

View File

@@ -125,6 +125,7 @@
class=" flex w-full user-message group"
dir={$settings.chatDirection}
id="message-{message.id}"
style="scroll-margin-top: 3rem;"
>
{#if !($settings?.chatBubble ?? true)}
<div class={`shrink-0 ltr:mr-3 rtl:ml-3 mt-1`}>