mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-12-16 16:30:15 +01:00
⚙️ fix: File Config Handling (#4664)
* chore: typing * refactor: create file filter from custom fileConfig, if provided * refactor: use logger utility to avoid overly verbose axios error logs when using RAG_API * fix(useFileHandling): use memoization/callbacks to make sure the appropriate fileConfig is used; refactor: move endpoint to first field applied to formdata * chore: update librechat-data-provider version to 0.7.54 * chore: revert type change
This commit is contained in:
parent
d60a0af878
commit
49ee88b6e8
5 changed files with 123 additions and 82 deletions
|
|
@ -2,6 +2,7 @@ const fs = require('fs');
|
|||
const axios = require('axios');
|
||||
const FormData = require('form-data');
|
||||
const { FileSources } = require('librechat-data-provider');
|
||||
const { logAxiosError } = require('~/utils');
|
||||
const { logger } = require('~/config');
|
||||
|
||||
/**
|
||||
|
|
@ -32,7 +33,10 @@ const deleteVectors = async (req, file) => {
|
|||
data: [file.file_id],
|
||||
});
|
||||
} catch (error) {
|
||||
logger.error('Error deleting vectors', error);
|
||||
logAxiosError({
|
||||
error,
|
||||
message: 'Error deleting vectors',
|
||||
});
|
||||
throw new Error(error.message || 'An error occurred during file deletion.');
|
||||
}
|
||||
};
|
||||
|
|
@ -91,7 +95,10 @@ async function uploadVectors({ req, file, file_id }) {
|
|||
embedded: Boolean(responseData.known_type),
|
||||
};
|
||||
} catch (error) {
|
||||
logger.error('Error embedding file', error);
|
||||
logAxiosError({
|
||||
error,
|
||||
message: 'Error uploading vectors',
|
||||
});
|
||||
throw new Error(error.message || 'An error occurred during file upload.');
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue