mirror of
https://github.com/open-webui/open-webui.git
synced 2026-02-24 12:11:56 +01:00
refac
Co-Authored-By: Classic298 <27028174+Classic298@users.noreply.github.com>
This commit is contained in:
@@ -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);
|
||||
};
|
||||
|
||||
|
||||
@@ -392,12 +392,7 @@
|
||||
delete history.messages[id];
|
||||
});
|
||||
|
||||
await tick();
|
||||
|
||||
showMessage({ id: parentMessageId });
|
||||
|
||||
// Update the chat
|
||||
await updateChat();
|
||||
showMessage({ id: parentMessageId }, false);
|
||||
};
|
||||
|
||||
const triggerScroll = () => {
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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`}>
|
||||
|
||||
Reference in New Issue
Block a user