🤖 fix: Minor Assistants Endpoint Fixes (#2472)

* fix(useCreateAssistantMutation): force re-render of assistants map by avoiding use shallow reference of listRes.data

* fix(AppService): regression by not including azure assistant defaults when no assistant endpoint values are set
This commit is contained in:
Danny Avila 2024-04-19 19:05:25 -04:00 committed by GitHub
parent 3d1dec62a4
commit e6310c806a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 48 additions and 17 deletions

View file

@ -154,9 +154,7 @@ describe('AppService', () => {
});
it('should default to `PNG` `imageOutputType` with no provided config', async () => {
require('./Config/loadCustomConfig').mockImplementationOnce(() =>
Promise.resolve(undefined),
);
require('./Config/loadCustomConfig').mockImplementationOnce(() => Promise.resolve(undefined));
await AppService(app);
expect(app.locals.imageOutputType).toEqual(EImageOutputType.PNG);
@ -230,6 +228,27 @@ describe('AppService', () => {
);
});
it('should correctly configure minimum Azure OpenAI Assistant values', async () => {
const assistantGroups = [azureGroups[0], { ...azureGroups[1], assistants: true }];
require('./Config/loadCustomConfig').mockImplementationOnce(() =>
Promise.resolve({
endpoints: {
[EModelEndpoint.azureOpenAI]: {
groups: assistantGroups,
assistants: true,
},
},
}),
);
process.env.WESTUS_API_KEY = 'westus-key';
process.env.EASTUS_API_KEY = 'eastus-key';
await AppService(app);
expect(app.locals).toHaveProperty(EModelEndpoint.assistants);
expect(app.locals[EModelEndpoint.assistants].capabilities.length).toEqual(3);
});
it('should correctly configure Azure OpenAI endpoint based on custom config', async () => {
require('./Config/loadCustomConfig').mockImplementationOnce(() =>
Promise.resolve({