Run model availability check in the background to speed up startup (#4256)

This commit is contained in:
Sandy Tao
2025-07-15 21:13:30 -07:00
committed by GitHub
parent d622e596a1
commit cba272082d
5 changed files with 68 additions and 53 deletions

View File

@@ -151,14 +151,12 @@ describe('Server Config (config.ts)', () => {
apiKey: 'test-key',
};
(createContentGeneratorConfig as Mock).mockResolvedValue(
mockContentConfig,
);
(createContentGeneratorConfig as Mock).mockReturnValue(mockContentConfig);
await config.refreshAuth(authType);
expect(createContentGeneratorConfig).toHaveBeenCalledWith(
MODEL, // Should be called with the original model 'gemini-pro'
config,
authType,
);
// Verify that contentGeneratorConfig is updated with the new model

View File

@@ -274,8 +274,8 @@ export class Config {
}
async refreshAuth(authMethod: AuthType) {
this.contentGeneratorConfig = await createContentGeneratorConfig(
this.model,
this.contentGeneratorConfig = createContentGeneratorConfig(
this,
authMethod,
);