From 1db6a5f9fdc451ebf8de4530e8ea1b996cbf47d0 Mon Sep 17 00:00:00 2001 From: "Timothy J. Baek" Date: Wed, 8 Nov 2023 01:25:18 -0800 Subject: [PATCH] fix: textarea resizing --- src/routes/+page.svelte | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/src/routes/+page.svelte b/src/routes/+page.svelte index 9b37640c..5bd22b93 100644 --- a/src/routes/+page.svelte +++ b/src/routes/+page.svelte @@ -675,6 +675,18 @@ } else if (messages.length != 0 && messages.at(-1).done != true) { console.log('wait'); } else { + document.getElementById('chat-textarea').style.height = ''; + + messages = [ + ...messages, + { + role: 'user', + content: userPrompt + } + ]; + + prompt = ''; + if (messages.length == 0) { await db.put('chats', { id: chatId, @@ -690,16 +702,6 @@ chats = await db.getAllFromIndex('chats', 'timestamp'); } - messages = [ - ...messages, - { - role: 'user', - content: userPrompt - } - ]; - - prompt = ''; - setTimeout(() => { window.scrollTo({ top: document.body.scrollHeight, behavior: 'smooth' }); }, 50); @@ -1099,6 +1101,7 @@ }} >