mirror of
https://github.com/tiennm99/ccs.git
synced 2026-10-12 20:15:40 +00:00
fix: keep live catalog defaults visible
This commit is contained in:
1 parent
c21f589247
commit
f9dec01cfd
7 files changed
+87
-18
No files matched your search
@@ -55,6 +55,18 @@ describe('model-catalog compatibility lookups', () => {
|
||||
expect(catalog?.models.map((model) => model.id)).toEqual(['gemini-2.5-pro']);
|
||||
});
|
||||
|
||||
it('falls back to a visible live model when the static default is absent', () => {
|
||||
const catalog = mergeCatalog('gemini', [
|
||||
{
|
||||
id: 'gemini-live-only',
|
||||
display_name: 'Gemini Live Only',
|
||||
},
|
||||
]);
|
||||
|
||||
expect(catalog?.defaultModel).toBe('gemini-live-only');
|
||||
expect(catalog?.models.map((model) => model.id)).toContain(catalog?.defaultModel);
|
||||
});
|
||||
|
||||
it('preserves static maxLevel when live thinking metadata omits it', () => {
|
||||
const catalog = mergeCatalog('claude', [
|
||||
{
|
||||
|
||||
@@ -483,9 +483,8 @@ export async function reconcileExhaustedRotationAccounts(
|
||||
return [];
|
||||
}
|
||||
|
||||
const { pauseAccountForQuotaCooldown, restoreExpiredQuotaPauses } = await import(
|
||||
'../accounts/account-safety'
|
||||
);
|
||||
const { pauseAccountForQuotaCooldown, restoreExpiredQuotaPauses } =
|
||||
await import('../accounts/account-safety');
|
||||
restoreExpiredQuotaPauses();
|
||||
|
||||
const config = loadOrCreateUnifiedConfig();
|
||||
@@ -593,9 +592,8 @@ export async function preflightCheck(provider: CLIProxyProvider): Promise<Prefli
|
||||
return { proceed: true, accountId: defaultAccount?.id || '' };
|
||||
}
|
||||
|
||||
const { pauseAccountForQuotaCooldown, restoreExpiredQuotaPauses } = await import(
|
||||
'../accounts/account-safety'
|
||||
);
|
||||
const { pauseAccountForQuotaCooldown, restoreExpiredQuotaPauses } =
|
||||
await import('../accounts/account-safety');
|
||||
restoreExpiredQuotaPauses();
|
||||
|
||||
const config = loadOrCreateUnifiedConfig();
|
||||
|
||||
@@ -249,7 +249,6 @@ export function mergeCatalog(
|
||||
if (!staticCatalog && filteredRemoteModels.length === 0) return undefined;
|
||||
|
||||
const displayName = staticCatalog?.displayName || provider;
|
||||
const defaultModel = staticCatalog?.defaultModel || (filteredRemoteModels[0]?.id ?? '');
|
||||
|
||||
// Build map of static models by lowercase ID for fast lookup
|
||||
const staticMap = new Map<string, ModelEntry>();
|
||||
@@ -260,14 +259,11 @@ export function mergeCatalog(
|
||||
}
|
||||
|
||||
// Process remote models: merge with static entries
|
||||
const mergedIds = new Set<string>();
|
||||
const mergedModels: ModelEntry[] = [];
|
||||
|
||||
for (const remote of filteredRemoteModels) {
|
||||
const remoteEntry = mapRemoteToModelEntry(remote);
|
||||
const staticEntry = staticMap.get(remote.id.toLowerCase());
|
||||
mergedIds.add(remote.id.toLowerCase());
|
||||
|
||||
if (staticEntry) {
|
||||
const mergedThinking = remoteEntry.thinking
|
||||
? {
|
||||
@@ -292,6 +288,12 @@ export function mergeCatalog(
|
||||
}
|
||||
}
|
||||
|
||||
const staticDefaultModel = staticCatalog?.defaultModel;
|
||||
const hasStaticDefaultModel =
|
||||
typeof staticDefaultModel === 'string' &&
|
||||
mergedModels.some((model) => model.id.toLowerCase() === staticDefaultModel.toLowerCase());
|
||||
const defaultModel = hasStaticDefaultModel ? staticDefaultModel : (mergedModels[0]?.id ?? '');
|
||||
|
||||
return {
|
||||
provider,
|
||||
displayName,
|
||||
|
||||
@@ -112,9 +112,8 @@ export async function runImageAnalysisCheck(results: HealthCheck): Promise<void>
|
||||
* Fix image analysis configuration issues
|
||||
*/
|
||||
export async function fixImageAnalysisConfig(): Promise<boolean> {
|
||||
const { updateConfig, loadOrCreateUnifiedConfig } = await import(
|
||||
'../../config/config-loader-facade'
|
||||
);
|
||||
const { updateConfig, loadOrCreateUnifiedConfig } =
|
||||
await import('../../config/config-loader-facade');
|
||||
|
||||
const config = loadOrCreateUnifiedConfig();
|
||||
let fixed = false;
|
||||
|
||||
Reference in new issue
Block a user