From fa8bb51b81c4cce8124fc3f83cf170a8575b0632 Mon Sep 17 00:00:00 2001 From: "Timothy J. Baek" Date: Tue, 3 Sep 2024 15:23:38 +0200 Subject: [PATCH] refac --- src/lib/components/chat/Chat.svelte | 29 ++++++++++++++--------------- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/src/lib/components/chat/Chat.svelte b/src/lib/components/chat/Chat.svelte index e65c15679..69992ec09 100644 --- a/src/lib/components/chat/Chat.svelte +++ b/src/lib/components/chat/Chat.svelte @@ -1328,27 +1328,26 @@ document.getElementById(`speak-button-${responseMessage.id}`)?.click(); } - - if ($chatId == _chatId) { - if ($settings.saveChatHistory ?? true) { - chat = await updateChatById(localStorage.token, _chatId, { - models: selectedModels, - messages: messages, - history: history, - params: params, - files: chatFiles - }); - - currentChatPage.set(1); - await chats.set(await getChatList(localStorage.token, $currentChatPage)); - } - } } else { await handleOpenAIError(null, res, model, responseMessage); } } catch (error) { await handleOpenAIError(error, null, model, responseMessage); } + + if ($chatId == _chatId) { + chat = await updateChatById(localStorage.token, _chatId, { + models: selectedModels, + messages: messages, + history: history, + params: params, + files: chatFiles + }); + + currentChatPage.set(1); + await chats.set(await getChatList(localStorage.token, $currentChatPage)); + } + messages = messages; stopResponseFlag = false;