diff --git a/src/routes/(app)/+layout.svelte b/src/routes/(app)/+layout.svelte index 3b09a246..9fa117cc 100644 --- a/src/routes/(app)/+layout.svelte +++ b/src/routes/(app)/+layout.svelte @@ -20,6 +20,9 @@ let ollamaVersion = ''; let loaded = false; + let DB = null; + let localDBChats = []; + const getModels = async () => { let models = []; models.push( @@ -69,16 +72,13 @@ if ($user === undefined) { await goto('/auth'); } else if (['user', 'admin'].includes($user.role)) { - const DB = await openDB('Chats', 1); + DB = await openDB('Chats', 1); if (DB) { - let chats = await DB.getAllFromIndex('chats', 'timestamp'); - chats = chats.map((item, idx) => chats[chats.length - 1 - idx]); + const chats = await DB.getAllFromIndex('chats', 'timestamp'); + localDBChats = chats.map((item, idx) => chats[chats.length - 1 - idx]); - if (chats.length > 0) { - let blob = new Blob([JSON.stringify(chats)], { type: 'application/json' }); - saveAs(blob, `chat-export-${Date.now()}.json`); - } + console.log('localdb', localDBChats); } console.log(DB); @@ -103,9 +103,9 @@ {#if loaded}
{#if !['user', 'admin'].includes($user.role)} -
+
@@ -121,7 +121,7 @@
{:else if checkVersion(REQUIRED_OLLAMA_VERSION, ollamaVersion ?? '0')} -
+
@@ -164,7 +164,7 @@
+ {:else if localDBChats.length > 0} +
+
+
+
+
+ Important Update
Action Required for Chat Log Storage +
+ +
+ Saving chat logs directly to your browser's storage is no longer supported. Please + take a moment to download and delete your chat logs by clicking the button below. + Don't worry, you can easily re-import your chat logs to the backend through Settings > Chats > Import Chats. This ensures that your valuable conversations are securely saved to your backend + database. Thank you! +
+ +
+ + + +
+
+
+
+
{/if}