🛂 fix: Only Perform allowedProviders Validation for Agents (#8487)

This commit is contained in:
Danny Avila 2025-07-15 18:43:47 -04:00 committed by GitHub
parent 01b012a8fa
commit 62b4f3b795
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 12 additions and 1 deletions

View file

@ -458,6 +458,12 @@ class AgentClient extends BaseClient {
res: this.options.res, res: this.options.res,
agent: prelimAgent, agent: prelimAgent,
allowedProviders, allowedProviders,
endpointOption: {
endpoint:
prelimAgent.id !== Constants.EPHEMERAL_AGENT_ID
? EModelEndpoint.agents
: memoryConfig.agent?.provider,
},
}); });
if (!agent) { if (!agent) {

View file

@ -8,6 +8,7 @@ const {
ErrorTypes, ErrorTypes,
EModelEndpoint, EModelEndpoint,
EToolResources, EToolResources,
isAgentsEndpoint,
replaceSpecialVars, replaceSpecialVars,
providerEndpointMap, providerEndpointMap,
} = require('librechat-data-provider'); } = require('librechat-data-provider');
@ -42,7 +43,11 @@ const initializeAgent = async ({
allowedProviders, allowedProviders,
isInitialAgent = false, isInitialAgent = false,
}) => { }) => {
if (allowedProviders.size > 0 && !allowedProviders.has(agent.provider)) { if (
isAgentsEndpoint(endpointOption?.endpoint) &&
allowedProviders.size > 0 &&
!allowedProviders.has(agent.provider)
) {
throw new Error( throw new Error(
`{ "type": "${ErrorTypes.INVALID_AGENT_PROVIDER}", "info": "${agent.provider}" }`, `{ "type": "${ErrorTypes.INVALID_AGENT_PROVIDER}", "info": "${agent.provider}" }`,
); );