From 3b7775a5356ddb5e0a3c95cb633824ae9d1edf25 Mon Sep 17 00:00:00 2001 From: Brandon Hulston Date: Mon, 15 Jan 2024 17:58:51 -0700 Subject: [PATCH 1/2] Fix chat import bug --- src/lib/components/chat/SettingsModal.svelte | 2 +- src/routes/(app)/c/[id]/+page.svelte | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/lib/components/chat/SettingsModal.svelte b/src/lib/components/chat/SettingsModal.svelte index 841cf9a39..35ad9f1aa 100644 --- a/src/lib/components/chat/SettingsModal.svelte +++ b/src/lib/components/chat/SettingsModal.svelte @@ -141,7 +141,7 @@ const importChats = async (_chats) => { for (const chat of _chats) { console.log(chat); - await createNewChat(localStorage.token, chat); + await createNewChat(localStorage.token, chat.chat); } await chats.set(await getChatList(localStorage.token)); diff --git a/src/routes/(app)/c/[id]/+page.svelte b/src/routes/(app)/c/[id]/+page.svelte index 7fb82955c..5c4c5f8ee 100644 --- a/src/routes/(app)/c/[id]/+page.svelte +++ b/src/routes/(app)/c/[id]/+page.svelte @@ -7,7 +7,7 @@ import { page } from '$app/stores'; import { models, modelfiles, user, settings, chats, chatId, config } from '$lib/stores'; - import { copyToClipboard, splitStream } from '$lib/utils'; + import { copyToClipboard, splitStream, convertMessagesToHistory } from '$lib/utils'; import { generateChatCompletion, generateTitle } from '$lib/apis/ollama'; import { createNewChat, getChatById, getChatList, updateChatById } from '$lib/apis/chats'; @@ -95,6 +95,8 @@ }); if (chat) { + console.log("Chat from getChatById1", chat) //Remove + console.log("Chat from getChatById2", chat.chat); // Remove const chatContent = chat.chat; if (chatContent) { @@ -103,7 +105,7 @@ selectedModels = (chatContent?.models ?? undefined) !== undefined ? chatContent.models - : [chatContent.model ?? '']; + : [chatContent.models ?? '']; history = (chatContent?.history ?? undefined) !== undefined ? chatContent.history From 4b3acfa49167c92e8063baac28458cf4bf3a32d5 Mon Sep 17 00:00:00 2001 From: Brandon Hulston Date: Mon, 15 Jan 2024 18:07:31 -0700 Subject: [PATCH 2/2] Remove console logs --- src/routes/(app)/c/[id]/+page.svelte | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/routes/(app)/c/[id]/+page.svelte b/src/routes/(app)/c/[id]/+page.svelte index 5c4c5f8ee..c0db9c5f3 100644 --- a/src/routes/(app)/c/[id]/+page.svelte +++ b/src/routes/(app)/c/[id]/+page.svelte @@ -95,8 +95,6 @@ }); if (chat) { - console.log("Chat from getChatById1", chat) //Remove - console.log("Chat from getChatById2", chat.chat); // Remove const chatContent = chat.chat; if (chatContent) {