From 8f1b9bdf8a57722b93ebfeac79cae7cfa42f7f70 Mon Sep 17 00:00:00 2001 From: "Timothy J. Baek" Date: Mon, 23 Sep 2024 23:52:45 +0200 Subject: [PATCH] refac --- .../chat/Messages/MultiResponseMessages.svelte | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/lib/components/chat/Messages/MultiResponseMessages.svelte b/src/lib/components/chat/Messages/MultiResponseMessages.svelte index 83ca78b3d..1bd4b8875 100644 --- a/src/lib/components/chat/Messages/MultiResponseMessages.svelte +++ b/src/lib/components/chat/Messages/MultiResponseMessages.svelte @@ -129,7 +129,7 @@ } else { return { ...a, - [modelIdx]: 0 + [modelIdx]: groupedMessageIds[modelIdx].messageIds.length - 1 }; } }, {}); @@ -149,7 +149,14 @@ }; onMount(async () => { - initHandler(); + await initHandler(); + await tick(); + + const messageElement = document.getElementById(`message-${messageId}`); + console.log(messageElement); + if (messageElement) { + messageElement.scrollIntoView({ behavior: 'smooth', block: 'center' }); + } });