mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-12-17 08:50:15 +01:00
⚓ refactor(loadConfigModels): Stricter Default Model Fallback (#2239)
* chore: add TEndpoint type/typedef * refactor(loadConfigModels.spec): stricter default model matching (fails with current impl.) * refactor(loadConfigModels): return default models on endpoint basis and not fetch basis * refactor: rename `uniqueKeyToNameMap` to `uniqueKeyToEndpointsMap` for clarity
This commit is contained in:
parent
0a8118deed
commit
dec7879cc1
4 changed files with 36 additions and 16 deletions
|
|
@ -267,6 +267,15 @@ describe('loadConfigModels', () => {
|
|||
getCustomConfig.mockResolvedValue({
|
||||
endpoints: {
|
||||
custom: [
|
||||
{
|
||||
name: 'EndpointWithSameFetchKey',
|
||||
apiKey: 'API_KEY',
|
||||
baseURL: 'http://example.com',
|
||||
models: {
|
||||
fetch: true,
|
||||
default: ['defaultModel1'],
|
||||
},
|
||||
},
|
||||
{
|
||||
name: 'EmptyFetchModel',
|
||||
apiKey: 'API_KEY',
|
||||
|
|
@ -283,14 +292,7 @@ describe('loadConfigModels', () => {
|
|||
fetchModels.mockResolvedValue([]);
|
||||
|
||||
const result = await loadConfigModels(mockRequest);
|
||||
|
||||
expect(fetchModels).toHaveBeenCalledWith(
|
||||
expect.objectContaining({
|
||||
name: 'EmptyFetchModel',
|
||||
apiKey: 'API_KEY',
|
||||
}),
|
||||
);
|
||||
|
||||
expect(fetchModels).toHaveBeenCalledTimes(1);
|
||||
expect(result.EmptyFetchModel).toEqual(['defaultModel1', 'defaultModel2']);
|
||||
});
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue