Skip to content

Commit

Permalink
* KDB: add progress bar
Browse files Browse the repository at this point in the history
  • Loading branch information
aliel committed Sep 11, 2024
1 parent 23f6a23 commit fd2fc21
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/pages/KnowledgeBase.vue
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,7 @@
</q-card-section>
</ltai-dialog>
</div>
<q-linear-progress v-if="downloadInProgress" indeterminate />
</section>
</template>
<script lang="ts" setup>
Expand Down Expand Up @@ -197,6 +198,7 @@ const showRenameKnowledgeBase = ref(false);
const showDeleteKnowledgeBaseConfirmation = ref(false);
const showRenameDocument = ref(false);
const showDeleteDocumentConfirmation = ref(false);
const downloadInProgress = ref(false);
watch(
() => route.params.id as string,
Expand Down Expand Up @@ -256,6 +258,8 @@ const uploadDocuments = async (event: any) => {
const encryptionKey = Buffer.from(knowledgeBaseIdentifierRef.value.encryption.key);
const encryptionIv = Buffer.from(knowledgeBaseIdentifierRef.value.encryption.iv);
downloadInProgress.value = true;
await Promise.all(
Array.from(target.files as FileList).map(async (file) => {
try {
Expand All @@ -267,11 +271,14 @@ const uploadDocuments = async (event: any) => {
...document,
store: { item_hash: uploadedFileMessage.item_hash, ipfs_hash: uploadedFileMessage.content.item_hash },
});
downloadInProgress.value = false;
} catch (error) {
$q.notify({
message: (error as Error)?.message ?? 'Document processing failed, please try again',
color: 'negative',
});
downloadInProgress.value = false;
}
}),
);
Expand Down

0 comments on commit fd2fc21

Please sign in to comment.