From d245b756a312db88c406311c316cddf3acfda1ee Mon Sep 17 00:00:00 2001 From: Andrew Ryan Date: Tue, 26 Mar 2024 11:46:22 -0700 Subject: [PATCH] Add wait for tick before scrolling down in openai We had this wait on ollama but not for openai, causing it to fail to scroll down in certain cases. This fixes the issue. --- src/routes/(app)/+page.svelte | 4 ++++ src/routes/(app)/c/[id]/+page.svelte | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/src/routes/(app)/+page.svelte b/src/routes/(app)/+page.svelte index 417ddccda..4df39f854 100644 --- a/src/routes/(app)/+page.svelte +++ b/src/routes/(app)/+page.svelte @@ -517,6 +517,10 @@ const sendPromptOpenAI = async (model, userPrompt, responseMessageId, _chatId) => { const responseMessage = history.messages[responseMessageId]; + + // Wait until history/message have been updated + await tick(); + scrollToBottom(); const docs = messages diff --git a/src/routes/(app)/c/[id]/+page.svelte b/src/routes/(app)/c/[id]/+page.svelte index 836fc90a4..2deaaf330 100644 --- a/src/routes/(app)/c/[id]/+page.svelte +++ b/src/routes/(app)/c/[id]/+page.svelte @@ -527,6 +527,10 @@ const sendPromptOpenAI = async (model, userPrompt, responseMessageId, _chatId) => { const responseMessage = history.messages[responseMessageId]; + + // Wait until history/message have been updated + await tick(); + scrollToBottom(); const docs = messages