From deddd8467c921d2851c09756f0fed4c074fe4a17 Mon Sep 17 00:00:00 2001 From: "Timothy J. Baek" Date: Thu, 7 Dec 2023 11:51:14 -0800 Subject: [PATCH 1/7] fix: files not found --- src/routes/(app)/c/[id]/+page.svelte | 1 + 1 file changed, 1 insertion(+) diff --git a/src/routes/(app)/c/[id]/+page.svelte b/src/routes/(app)/c/[id]/+page.svelte index 405c02ac..d9f43793 100644 --- a/src/routes/(app)/c/[id]/+page.svelte +++ b/src/routes/(app)/c/[id]/+page.svelte @@ -29,6 +29,7 @@ let title = ''; let prompt = ''; + let files = []; let messages = []; let history = { From 2e77a8d874586ea229ab40453bd9180e70c14d53 Mon Sep 17 00:00:00 2001 From: "Timothy J. Baek" Date: Thu, 7 Dec 2023 11:52:12 -0800 Subject: [PATCH 2/7] Revert "fix: files not found" This reverts commit deddd8467c921d2851c09756f0fed4c074fe4a17. --- src/routes/(app)/c/[id]/+page.svelte | 1 - 1 file changed, 1 deletion(-) diff --git a/src/routes/(app)/c/[id]/+page.svelte b/src/routes/(app)/c/[id]/+page.svelte index d9f43793..405c02ac 100644 --- a/src/routes/(app)/c/[id]/+page.svelte +++ b/src/routes/(app)/c/[id]/+page.svelte @@ -29,7 +29,6 @@ let title = ''; let prompt = ''; - let files = []; let messages = []; let history = { From 83e8db9b6a8fb3728c083cc500fb94c7da62a965 Mon Sep 17 00:00:00 2001 From: "Timothy J. Baek" Date: Sun, 10 Dec 2023 22:47:16 -0800 Subject: [PATCH 3/7] feat: /chat route support --- src/lib/components/chat/Messages.svelte | 430 ++++++++++++++---------- src/routes/(app)/+page.svelte | 124 +++---- src/routes/(app)/c/[id]/+page.svelte | 115 ++++--- 3 files changed, 373 insertions(+), 296 deletions(-) diff --git a/src/lib/components/chat/Messages.svelte b/src/lib/components/chat/Messages.svelte index 36fc6ce3..dc454550 100644 --- a/src/lib/components/chat/Messages.svelte +++ b/src/lib/components/chat/Messages.svelte @@ -163,6 +163,13 @@ // let editMessage = history.messages[messageId]; history.messages[messageId].edit = true; history.messages[messageId].editedContent = history.messages[messageId].content; + + await tick(); + + const editElement = document.getElementById(`message-edit-${messageId}`); + + editElement.style.height = ''; + editElement.style.height = `${editElement.scrollHeight}px`; }; const confirmEditMessage = async (messageId) => { @@ -195,6 +202,11 @@ await sendPrompt(userPrompt, userMessageId, $chatId); }; + const confirmEditResponseMessage = async (messageId) => { + history.messages[messageId].edit = false; + history.messages[messageId].content = history.messages[messageId].editedContent; + }; + const cancelEditMessage = (messageId) => { history.messages[messageId].edit = false; history.messages[messageId].editedContent = undefined; @@ -415,6 +427,7 @@ {#if message?.edit === true}