🚀 feat: Enhance S3 URL Expiry with Refresh; fix: S3 File Deletion (#6647)

* refactor: Improve error logging in image fetching to base64 conversion

* fix: Add error handling for custom endpoint configuration retrieval

* fix: Update audio stream processing to parse text parts from complex message content

* chore: import order in streamAudio

* fix: S3 file deletion and optimize file upload

* feat: Implement S3 URL refresh mechanism and add cache for expiry check intervals

* feat: Add S3 URL refresh functionality for agent avatars

* chore: remove unnecessary console.log in MultiMessage component

* chore: update version of librechat-data-provider to 0.7.77
This commit is contained in:
Danny Avila 2025-03-31 18:40:06 -04:00 committed by GitHub
parent bc039cea29
commit 3c91f7b0b7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
12 changed files with 358 additions and 42 deletions

View file

@ -134,6 +134,28 @@ const deleteFiles = async (file_ids, user) => {
return await File.deleteMany(deleteQuery);
};
/**
* Batch updates files with new signed URLs in MongoDB
*
* @param {MongoFile[]} updates - Array of updates in the format { file_id, filepath }
* @returns {Promise<void>}
*/
async function batchUpdateFiles(updates) {
if (!updates || updates.length === 0) {
return;
}
const bulkOperations = updates.map((update) => ({
updateOne: {
filter: { file_id: update.file_id },
update: { $set: { filepath: update.filepath } },
},
}));
const result = await File.bulkWrite(bulkOperations);
logger.info(`Updated ${result.modifiedCount} files with new S3 URLs`);
}
module.exports = {
File,
findFileById,
@ -145,4 +167,5 @@ module.exports = {
deleteFile,
deleteFiles,
deleteFileByFilter,
batchUpdateFiles,
};