|
@@ -1,14 +1,15 @@
|
|
|
<script lang="ts">
|
|
|
+ import { v4 as uuidv4 } from 'uuid';
|
|
|
import { openDB, deleteDB } from 'idb';
|
|
|
import { onMount, tick } from 'svelte';
|
|
|
import { goto } from '$app/navigation';
|
|
|
|
|
|
- import { config, user, showSettings, settings, models, db, chats } from '$lib/stores';
|
|
|
+ import { config, user, showSettings, settings, models, db, chats, chatId } from '$lib/stores';
|
|
|
|
|
|
import SettingsModal from '$lib/components/chat/SettingsModal.svelte';
|
|
|
import Sidebar from '$lib/components/layout/Sidebar.svelte';
|
|
|
import toast from 'svelte-french-toast';
|
|
|
- import { OLLAMA_API_BASE_URL } from '$lib/constants';
|
|
|
+ import { OLLAMA_API_BASE_URL, WEBUI_API_BASE_URL } from '$lib/constants';
|
|
|
|
|
|
let loaded = false;
|
|
|
|
|
@@ -133,6 +134,10 @@
|
|
|
await chats.set(await this.getChats());
|
|
|
},
|
|
|
deleteChatById: async function (id) {
|
|
|
+ if ($chatId === id) {
|
|
|
+ goto('/');
|
|
|
+ await chatId.set(uuidv4());
|
|
|
+ }
|
|
|
await this.db.delete('chats', id);
|
|
|
await chats.set(await this.getChats());
|
|
|
},
|