mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-12-17 17:00:15 +01:00
* chore: fix mock typing in packages/api tests * chore: improve imports, type handling and method signatures for MCPServersRegistry * chore: use enum in migration scripts * chore: ParsedServerConfig type to enhance server configuration handling * feat: Implement agent permissions migration check and logging * feat: Integrate migration checks into server initialization process * feat: Add prompt permissions migration check and logging to server initialization * chore: move prompt formatting functions to dedicated prompts dir
45 lines
1.3 KiB
JavaScript
45 lines
1.3 KiB
JavaScript
const { logger } = require('@librechat/data-schemas');
|
|
const {
|
|
logAgentMigrationWarning,
|
|
logPromptMigrationWarning,
|
|
checkAgentPermissionsMigration,
|
|
checkPromptPermissionsMigration,
|
|
} = require('@librechat/api');
|
|
const { getProjectByName } = require('~/models/Project');
|
|
const { Agent, PromptGroup } = require('~/db/models');
|
|
const { findRoleByIdentifier } = require('~/models');
|
|
|
|
/**
|
|
* Check if permissions migrations are needed for shared resources
|
|
* This runs at the end to ensure all systems are initialized
|
|
*/
|
|
async function checkMigrations() {
|
|
try {
|
|
const agentMigrationResult = await checkAgentPermissionsMigration({
|
|
db: {
|
|
findRoleByIdentifier,
|
|
getProjectByName,
|
|
},
|
|
AgentModel: Agent,
|
|
});
|
|
logAgentMigrationWarning(agentMigrationResult);
|
|
} catch (error) {
|
|
logger.error('Failed to check agent permissions migration:', error);
|
|
}
|
|
try {
|
|
const promptMigrationResult = await checkPromptPermissionsMigration({
|
|
db: {
|
|
findRoleByIdentifier,
|
|
getProjectByName,
|
|
},
|
|
PromptGroupModel: PromptGroup,
|
|
});
|
|
logPromptMigrationWarning(promptMigrationResult);
|
|
} catch (error) {
|
|
logger.error('Failed to check prompt permissions migration:', error);
|
|
}
|
|
}
|
|
|
|
module.exports = {
|
|
checkMigrations,
|
|
};
|