{#if $user?.role === 'admin'} {/if}
{#if !($settings.saveChatHistory ?? true)}
{$i18n.t('Chat History is off for this browser.')}
{$i18n.t( "When history is turned off, new chats on this browser won't appear in your history on any of your devices." )} {$i18n.t('This setting does not sync across browsers or devices.')}
{/if}
{#if $tags.length > 0}
{#each $tags as tag} {/each}
{/if}
{#each $chats.filter((chat) => { if (search === '') { return true; } else { let title = chat.title.toLowerCase(); const query = search.toLowerCase(); let contentMatches = false; // Access the messages within chat.chat.messages if (chat.chat && chat.chat.messages && Array.isArray(chat.chat.messages)) { contentMatches = chat.chat.messages.some((message) => { // Check if message.content exists and includes the search query return message.content && message.content.toLowerCase().includes(query); }); } return title.includes(query) || contentMatches; } }) as chat, i}
{#if chatTitleEditId === chat.id}
{:else} { selectedChatId = chat.id; if (window.innerWidth < 1024) { show = false; } }} draggable="false" >
{chat.title}
{/if}
{#if chatTitleEditId === chat.id}
{:else if chatDeleteId === chat.id}
{:else}
{ shareChatId = selectedChatId; showShareChatModal = true; }} renameHandler={() => { chatTitle = chat.title; chatTitleEditId = chat.id; }} deleteHandler={() => { chatDeleteId = chat.id; }} onClose={() => { selectedChatId = null; }} >
{/if}
{/each}
{#if $user !== undefined} {#if showDropdown} {/if} {/if}