This commit is contained in:
Timothy Jaeryang Baek committed 2026-05-20 01:34:07 +04:00
1 parent 9835b3f1dd
commit 97252fa609
1 file changed
+3 -15
@@ -678,11 +678,7 @@
); );
let uploadedCount = 0; let uploadedCount = 0;
const BATCH_SIZE = 3; for (const entry of filesToUpload) {
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++; uploadedCount++;
const displayPath = entry.path ? `${entry.path}/${entry.filename}` : entry.filename; const displayPath = entry.path ? `${entry.path}/${entry.filename}` : entry.filename;
syncing = $i18n.t('Uploading {{current}}/{{total}}: {{file}}', { syncing = $i18n.t('Uploading {{current}}/{{total}}: {{file}}', {
@@ -692,19 +688,11 @@
}); });
const fileObject = new File([entry.file], entry.filename, { type: entry.file.type }); const fileObject = new File([entry.file], entry.filename, { type: entry.file.type });
await uploadFile( await uploadFile(localStorage.token, fileObject, {
localStorage.token,
fileObject,
{
knowledge_id: knowledge.id, knowledge_id: knowledge.id,
file_hash: entry.checksum, file_hash: entry.checksum,
directory_id: entry.path ? createdDirectoryIds[entry.path] : null directory_id: entry.path ? createdDirectoryIds[entry.path] : null
}, }).catch(() => null);
null,
false
).catch(() => null);
})
);
} }
// ── 6. Cleanup — remove deleted files + rmdir orphaned directories ── // ── 6. Cleanup — remove deleted files + rmdir orphaned directories ──