{$i18n.t('Documents')} | {$WEBUI_NAME} {#if dragged}
Drop any files here to add to my documents
{/if} {#key selectedDoc} {/key}
{$i18n.t('Documents')}

{#if tags.length > 0}
doc?.selected === 'checked').length === filteredDocs.length ? 'checked' : 'unchecked'} indeterminate={filteredDocs.filter((doc) => doc?.selected === 'checked').length > 0 && filteredDocs.filter((doc) => doc?.selected === 'checked').length !== filteredDocs.length} on:change={(e) => { if (e.detail === 'checked') { filteredDocs = filteredDocs.map((doc) => ({ ...doc, selected: 'checked' })); } else if (e.detail === 'unchecked') { filteredDocs = filteredDocs.map((doc) => ({ ...doc, selected: 'unchecked' })); } }} />
{#if filteredDocs.filter((doc) => doc?.selected === 'checked').length === 0} {#each tags as tag} {/each} {:else}
{filteredDocs.filter((doc) => doc?.selected === 'checked').length} Selected
{/if}
{/if}
{#each filteredDocs as doc}
{/each}
ⓘ {$i18n.t("Use '#' in the prompt input to load and select your documents.")}
{ console.log(importFiles); const reader = new FileReader(); reader.onload = async (event) => { const savedDocs = JSON.parse(event.target.result); console.log(savedDocs); for (const doc of savedDocs) { await createNewDoc( localStorage.token, doc.collection_name, doc.filename, doc.name, doc.title ).catch((error) => { toast.error(error); return null; }); } await documents.set(await getDocs(localStorage.token)); }; reader.readAsText(importFiles[0]); }} />