mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-12-17 08:50:15 +01:00
🔍 fix: Retrieve Multiple Agents In File Access Check (#9695)
- Implemented `getAgents` function to retrieve multiple agent documents based on search parameters. - Updated `fileAccess` middleware to utilize `getAgents` instead of `getAgent` for improved file access checks. - Added comprehensive tests for file access middleware, covering various scenarios including user permissions and agent ownership.
This commit is contained in:
parent
f6d34d78ca
commit
89d12a8ccd
3 changed files with 495 additions and 3 deletions
|
|
@ -49,6 +49,14 @@ const createAgent = async (agentData) => {
|
|||
*/
|
||||
const getAgent = async (searchParameter) => await Agent.findOne(searchParameter).lean();
|
||||
|
||||
/**
|
||||
* Get multiple agent documents based on the provided search parameters.
|
||||
*
|
||||
* @param {Object} searchParameter - The search parameters to find agents.
|
||||
* @returns {Promise<Agent[]>} Array of agent documents as plain objects.
|
||||
*/
|
||||
const getAgents = async (searchParameter) => await Agent.find(searchParameter).lean();
|
||||
|
||||
/**
|
||||
* Load an agent based on the provided ID
|
||||
*
|
||||
|
|
@ -835,6 +843,7 @@ const countPromotedAgents = async () => {
|
|||
|
||||
module.exports = {
|
||||
getAgent,
|
||||
getAgents,
|
||||
loadAgent,
|
||||
createAgent,
|
||||
updateAgent,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue