mirror of
https://github.com/danny-avila/LibreChat.git
synced 2026-06-09 17:31:19 +00:00
🪪 fix: Resolve Group-Scoped Config Overrides (#13176)
Some checks are pending
Docker Dev Branch Images Build / build (Dockerfile, lc-dev, node) (push) Waiting to run
Docker Dev Branch Images Build / build (Dockerfile.multi, lc-dev-api, api-build) (push) Waiting to run
GitNexus Index / index (push) Waiting to run
GitNexus Index / post-index (push) Blocked by required conditions
Some checks are pending
Docker Dev Branch Images Build / build (Dockerfile, lc-dev, node) (push) Waiting to run
Docker Dev Branch Images Build / build (Dockerfile.multi, lc-dev-api, api-build) (push) Waiting to run
GitNexus Index / index (push) Waiting to run
GitNexus Index / post-index (push) Blocked by required conditions
* fix: resolve group-scoped config overrides * test: fix endpoint config request mock typing * fix: keep remote agent preauth config tenant-scoped * test: align config scoping expectations * test: reproduce group endpoint override resolution
This commit is contained in:
parent
ac163c2212
commit
c342e2345b
19 changed files with 311 additions and 40 deletions
|
|
@ -93,6 +93,41 @@ describe('loadConfigModels', () => {
|
|||
expect(result).toEqual({});
|
||||
});
|
||||
|
||||
it('passes userId when resolving scoped model config', async () => {
|
||||
getAppConfig.mockResolvedValue({});
|
||||
|
||||
await loadConfigModels({
|
||||
user: { id: 'testUserId', role: 'USER', tenantId: 'tenant-a' },
|
||||
});
|
||||
|
||||
expect(getAppConfig).toHaveBeenCalledWith({
|
||||
role: 'USER',
|
||||
userId: 'testUserId',
|
||||
tenantId: 'tenant-a',
|
||||
});
|
||||
});
|
||||
|
||||
it('uses req.config when available instead of calling getAppConfig', async () => {
|
||||
const result = await loadConfigModels({
|
||||
user: { id: 'testUserId' },
|
||||
config: {
|
||||
endpoints: {
|
||||
custom: [
|
||||
{
|
||||
name: 'LocalOnly',
|
||||
apiKey: 'local-key',
|
||||
baseURL: 'https://example.com/v1',
|
||||
models: { default: ['local-model'], fetch: false },
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
expect(getAppConfig).not.toHaveBeenCalled();
|
||||
expect(result.LocalOnly).toEqual(['local-model']);
|
||||
});
|
||||
|
||||
it('handles azure models and endpoint correctly', async () => {
|
||||
getAppConfig.mockResolvedValue({
|
||||
endpoints: {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue