From 97252fa609440573251d8e75090f347ed1e51e1d Mon Sep 17 00:00:00 2001 From: Timothy Jaeryang Baek Date: Wed, 20 May 2026 01:34:07 +0400 Subject: [PATCH] refac --- .../workspace/Knowledge/KnowledgeBase.svelte | 40 +++++++------------ 1 file changed, 14 insertions(+), 26 deletions(-) diff --git a/src/lib/components/workspace/Knowledge/KnowledgeBase.svelte b/src/lib/components/workspace/Knowledge/KnowledgeBase.svelte index 83ac79febb..e9dbbe5a0d 100644 --- a/src/lib/components/workspace/Knowledge/KnowledgeBase.svelte +++ b/src/lib/components/workspace/Knowledge/KnowledgeBase.svelte @@ -678,33 +678,21 @@ ); let uploadedCount = 0; - const BATCH_SIZE = 3; - for (let i = 0; i < filesToUpload.length; i += BATCH_SIZE) { - const batch = filesToUpload.slice(i, i + BATCH_SIZE); - await Promise.all( - batch.map(async (entry) => { - uploadedCount++; - const displayPath = entry.path ? `${entry.path}/${entry.filename}` : entry.filename; - syncing = $i18n.t('Uploading {{current}}/{{total}}: {{file}}', { - current: uploadedCount, - total: filesToUpload.length, - file: displayPath - }); + for (const entry of filesToUpload) { + uploadedCount++; + const displayPath = entry.path ? `${entry.path}/${entry.filename}` : entry.filename; + syncing = $i18n.t('Uploading {{current}}/{{total}}: {{file}}', { + current: uploadedCount, + total: filesToUpload.length, + file: displayPath + }); - const fileObject = new File([entry.file], entry.filename, { type: entry.file.type }); - await uploadFile( - localStorage.token, - fileObject, - { - knowledge_id: knowledge.id, - file_hash: entry.checksum, - directory_id: entry.path ? createdDirectoryIds[entry.path] : null - }, - null, - false - ).catch(() => null); - }) - ); + const fileObject = new File([entry.file], entry.filename, { type: entry.file.type }); + await uploadFile(localStorage.token, fileObject, { + knowledge_id: knowledge.id, + file_hash: entry.checksum, + directory_id: entry.path ? createdDirectoryIds[entry.path] : null + }).catch(() => null); } // ── 6. Cleanup — remove deleted files + rmdir orphaned directories ──