Fix character attachment content saving into settings.json

This commit is contained in:
Cohee
2024-10-03 22:13:37 +03:00
parent c59afd1b56
commit 1278b5c309
2 changed files with 23 additions and 2 deletions

View File

@ -466,13 +466,13 @@ async function ingestDataBankAttachments(source) {
}
// Download and process the file
file.text = await getFileAttachment(file.url);
const fileText = await getFileAttachment(file.url);
console.log(`Vectors: Retrieved file ${file.name} from Data Bank`);
// Convert kilobytes to string length
const thresholdLength = settings.size_threshold_db * 1024;
// Use chunk size from settings if file is larger than threshold
const chunkSize = file.size > thresholdLength ? settings.chunk_size_db : -1;
await vectorizeFile(file.text, file.name, collectionId, chunkSize, settings.overlap_percent_db);
await vectorizeFile(fileText, file.name, collectionId, chunkSize, settings.overlap_percent_db);
}
return dataBankCollectionIds;