{ goto('/'); await chatId.set(uuidv4()); // createNewChat(); }} >
New Chat
{ goto('/presets'); }} >
Presets
{#each $chats.filter((chat) => { if (search === '') { return true; } else { let title = chat.title.toLowerCase(); if (title.includes(search)) { return true; } else { return false; } } }) as chat, i}
{ // goto(`/c/${chat.id}`); if (chat.id !== chatTitleEditId) { chatTitleEditId = null; chatTitle = ''; } if (chat.id !== $chatId) { loadChat(chat.id); } }} >
{#if chatTitleEditId === chat.id}
{:else} {chat.title} {/if}
{#if chat.id === $chatId}
{#if chatTitleEditId === chat.id}
{ editChatTitle(chat.id, chatTitle); chatTitleEditId = null; chatTitle = ''; }} >
{ chatTitleEditId = null; chatTitle = ''; }} >
{:else if chatDeleteId === chat.id}
{ deleteChat(chat.id); }} >
{ chatDeleteId = null; }} >
{:else}
{ chatTitle = chat.title; chatTitleEditId = chat.id; // editChatTitle(chat.id, 'a'); }} >
{ chatDeleteId = chat.id; }} >
{/if}
{/if}
{/each}
{ importFileInputElement.click(); // importChats(); }} >
Import
{ exportChats(); }} >
Export
{ deleteChatHistory(); }} >
Clear conversations
{#if $user !== undefined}
{ showDropdown = !showDropdown; }} on:focusout={() => { setTimeout(() => { showDropdown = false; }, 150); }} >
{$user.name}
{#if showDropdown}
{#if $user.role === 'admin'}
{ goto('/admin'); }} >
Admin Panel
{/if}
{ await showSettings.set(true); }} >
Settings
{ localStorage.removeItem('token'); location.href = '/auth'; }} >
Sign Out
{/if} {:else}
{ await showSettings.set(true); }} >
Settings
{/if}
{ show = !show; }} >