mirror of
https://github.com/danny-avila/LibreChat.git
synced 2026-07-11 00:33:40 +00:00
fix: narrow remote agent run config
This commit is contained in:
parent
95023c8847
commit
a2791bee5d
2 changed files with 18 additions and 3 deletions
|
|
@ -111,10 +111,16 @@ describe('createAgentChatCompletion - MCP permission user propagation', () => {
|
|||
|
||||
it('forwards appConfig and tenantId to createRun', async () => {
|
||||
const appConfig = {
|
||||
endpoints: {
|
||||
agents: { capabilities: ['execute_code'] },
|
||||
},
|
||||
langfuse: {
|
||||
publicKey: 'pk-tenant-1',
|
||||
secretKey: 'sk-tenant-1',
|
||||
},
|
||||
interfaceConfig: {
|
||||
modelSelect: true,
|
||||
},
|
||||
};
|
||||
deps.appConfig = appConfig as never;
|
||||
const req = createMockReq({
|
||||
|
|
@ -128,6 +134,10 @@ describe('createAgentChatCompletion - MCP permission user propagation', () => {
|
|||
expect(createRun).toHaveBeenCalledTimes(1);
|
||||
const runArgs = createRun.mock.calls[0][0] as CreateRunArgs;
|
||||
expect(runArgs.tenantId).toBe('tenant-1');
|
||||
expect(runArgs.appConfig).toBe(appConfig);
|
||||
expect(runArgs.appConfig).toEqual({
|
||||
endpoints: appConfig.endpoints,
|
||||
langfuse: appConfig.langfuse,
|
||||
});
|
||||
expect(runArgs.appConfig).not.toHaveProperty('interfaceConfig');
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -178,7 +178,7 @@ type CreateRunFn = (params: {
|
|||
requestBody: Record<string, unknown>;
|
||||
user: Record<string, unknown>;
|
||||
tenantId?: string;
|
||||
appConfig?: AppConfig;
|
||||
appConfig?: Pick<AppConfig, 'endpoints' | 'langfuse'>;
|
||||
tokenCounter?: (message: unknown) => number;
|
||||
}) => Promise<{
|
||||
Graph?: unknown;
|
||||
|
|
@ -529,7 +529,12 @@ export async function createAgentChatCompletion(
|
|||
},
|
||||
user: safeUser,
|
||||
tenantId: typeof reqUser?.tenantId === 'string' ? reqUser.tenantId : undefined,
|
||||
appConfig: deps.appConfig,
|
||||
appConfig: deps.appConfig
|
||||
? {
|
||||
endpoints: deps.appConfig.endpoints,
|
||||
langfuse: deps.appConfig.langfuse,
|
||||
}
|
||||
: undefined,
|
||||
});
|
||||
|
||||
if (run) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue