{ goto('/'); await chatId.set(uuidv4()); // createNewChat(); }} >
New Chat
{#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 !== chatTitleEditIdx) { chatTitleEditIdx = null; chatTitle = ''; } if (chat.id !== $chatId) { loadChat(chat.id); } }} >
{#if chatTitleEditIdx === chat.id}
{:else} {chat.title} {/if}
{#if chat.id === $chatId}
{#if chatTitleEditIdx === chat.id}
{ editChatTitle(chat.id, chatTitle); chatTitleEditIdx = null; chatTitle = ''; }} >
{ chatTitleEditIdx = null; chatTitle = ''; }} >
{:else}
{ chatTitle = chat.title; chatTitleEditIdx = chat.id; // editChatTitle(chat.id, 'a'); }} >
{ deleteChat(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; }} >