{#if dragged}
Drop any files here to add to my documents
{/if} {#key selectedDoc}
{/key}
{ if (inputFiles && inputFiles.length > 0) { const file = inputFiles[0]; if ( SUPPORTED_FILE_TYPE.includes(file['type']) || SUPPORTED_FILE_EXTENSIONS.includes(file.name.split('.').at(-1)) ) { uploadDoc(file); } else { toast.error( `Unknown File Type '${file['type']}', but accepting and treating as plain text` ); uploadDoc(file); } inputFiles = null; e.target.value = ''; } else { toast.error(`File not found.`); } }} />
My Documents
{ document.getElementById('upload-doc-input')?.click(); }} >
{#if tags.length > 0}
{ selectedTag = ''; // await chats.set(await getChatListByTagName(localStorage.token, tag.name)); }} >
all
{#each tags as tag}
{ selectedTag = tag; // await chats.set(await getChatListByTagName(localStorage.token, tag.name)); }} >
#{tag}
{/each}
{/if} {#each $documents.filter((doc) => (selectedTag === '' || (doc?.content?.tags ?? []) .map((tag) => tag.name) .includes(selectedTag)) && (query === '' || doc.name.includes(query))) as doc}
{#if doc}
{:else}
{/if}
#{doc.name} ({doc.filename})
{doc.title}
{ showEditDocModal = !showEditDocModal; selectedDoc = doc; }} >
{ deleteDoc(doc.name); }} >
{/each}
{ 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]); }} />
{ document.getElementById('documents-import-input')?.click(); }} >
Import Documents Mapping
{ let blob = new Blob([JSON.stringify($documents)], { type: 'application/json' }); saveAs(blob, `documents-mapping-export-${Date.now()}.json`); }} >
Export Documents Mapping
Tip: Use '#' in the prompt input to swiftly load and select your documents.