From 2972774d872066fe179c0e255e9a9dc1a8603621 Mon Sep 17 00:00:00 2001 From: "Timothy J. Baek" Date: Mon, 10 Jun 2024 00:07:47 -0700 Subject: [PATCH] refac --- src/lib/components/chat/Chat.svelte | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/lib/components/chat/Chat.svelte b/src/lib/components/chat/Chat.svelte index b09faf110..49ba8961d 100644 --- a/src/lib/components/chat/Chat.svelte +++ b/src/lib/components/chat/Chat.svelte @@ -327,6 +327,9 @@ chatTextAreaElement.style.height = ''; } + const _files = JSON.parse(JSON.stringify(files)); + files = []; + prompt = ''; // Create user message @@ -338,7 +341,7 @@ role: 'user', user: _user ?? undefined, content: userPrompt, - files: files.length > 0 ? files : undefined, + files: _files.length > 0 ? _files : undefined, timestamp: Math.floor(Date.now() / 1000), // Unix epoch models: selectedModels.filter((m, mIdx) => selectedModels.indexOf(m) === mIdx) }; @@ -378,9 +381,6 @@ } await tick(); } - - files = []; - // Send prompt _responses = await sendPrompt(userPrompt, userMessageId); }