diff --git a/src/lib/components/layout/Navbar.svelte b/src/lib/components/layout/Navbar.svelte index 28503a70..4784a5ee 100644 --- a/src/lib/components/layout/Navbar.svelte +++ b/src/lib/components/layout/Navbar.svelte @@ -6,18 +6,30 @@ let importFileInputElement; let importFiles; + export let selectedChatId = ''; export let title: string = 'Ollama Web UI'; export let chats = []; export let createNewChat: Function; export let loadChat: Function; + export let deleteChat: Function; + export let editChatTitle: Function; export let importChatHistory: Function; export let exportChatHistory: Function; export let deleteChatHistory: Function; export let openSettings: Function; + let chatTitleEditIdx = null; + let chatTitle = ''; + + let _chats = chats.map((item, idx) => chats[chats.length - 1 - idx]); + onMount(() => {}); + $: if (chats) { + _chats = chats.map((item, idx) => chats[chats.length - 1 - idx]); + } + $: if (importFiles) { console.log(importFiles); @@ -99,8 +111,8 @@ : '-translate-x-72'} w-72 fixed top-0 left-0 z-40 transition bg-gray-900 text-gray-200 shadow-2xl text-sm " > -
-
+
+
-
- {#each chats.reverse() as chat, i} - +
+ {#each _chats as chat, i} +
+ + + {#if chat.id === selectedChatId} +
+ {#if chatTitleEditIdx === chat.id} +
+ + +
+ {:else} +
+ + +
+ {/if} +
+ {/if} +
{/each}
-
+

+ +
+ {/if} {/if}
{/if}