mirror of
https://github.com/tiennm99/ccs.git
synced 2026-10-12 22:14:22 +00:00
fix(cliproxy): keep new live provider models selectable
This commit is contained in:
1 parent
0e4677f558
commit
34d70442bf
2 files changed
+27
-11
No files matched your search
@@ -936,39 +936,47 @@ export function getSupplementalCatalogModels(
|
|||||||
.map((modelId) => normalizeModelId(modelId))
|
.map((modelId) => normalizeModelId(modelId))
|
||||||
);
|
);
|
||||||
const seenCanonicalIds = new Set<string>();
|
const seenCanonicalIds = new Set<string>();
|
||||||
const normalizedAvailableIds = new Set(
|
const normalizedRawIds = new Set(availableModels.map((model) => normalizeModelId(model.id)));
|
||||||
availableModels.map((model) => normalizeModelId(stripManagedModelPrefix(model.id)))
|
|
||||||
);
|
|
||||||
|
|
||||||
return availableModels.filter((availableModel) => {
|
return availableModels.filter((availableModel) => {
|
||||||
|
const normalizedAvailableModelId = normalizeModelId(availableModel.id);
|
||||||
const strippedModelId = stripManagedModelPrefix(availableModel.id);
|
const strippedModelId = stripManagedModelPrefix(availableModel.id);
|
||||||
const baseModelId = stripCustomtoolsSuffix(strippedModelId);
|
const baseModelId = stripCustomtoolsSuffix(strippedModelId);
|
||||||
const matchedModel =
|
const matchedModel =
|
||||||
findCatalogModelInCatalog(staticCatalog, strippedModelId) ??
|
findCatalogModelInCatalog(staticCatalog, strippedModelId) ??
|
||||||
findCatalogModelInCatalog(staticCatalog, baseModelId);
|
findCatalogModelInCatalog(staticCatalog, baseModelId);
|
||||||
|
|
||||||
if (!matchedModel) return false;
|
|
||||||
|
|
||||||
if (recommendedIds.has(normalizeModelId(strippedModelId))) {
|
if (recommendedIds.has(normalizeModelId(strippedModelId))) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
const canonicalId = normalizeModelId(matchedModel.id);
|
if (
|
||||||
if (recommendedCanonicalIds.has(canonicalId)) {
|
normalizedAvailableModelId !== normalizeModelId(strippedModelId) &&
|
||||||
return false;
|
normalizedRawIds.has(normalizeModelId(strippedModelId))
|
||||||
}
|
) {
|
||||||
if (seenCanonicalIds.has(canonicalId)) {
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
const normalizedBaseModelId = normalizeModelId(baseModelId);
|
const normalizedBaseModelId = normalizeModelId(baseModelId);
|
||||||
if (
|
if (
|
||||||
normalizedBaseModelId !== normalizeModelId(strippedModelId) &&
|
normalizedBaseModelId !== normalizeModelId(strippedModelId) &&
|
||||||
normalizedAvailableIds.has(normalizedBaseModelId)
|
normalizedRawIds.has(normalizedBaseModelId)
|
||||||
) {
|
) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const canonicalId = matchedModel ? normalizeModelId(matchedModel.id) : normalizedBaseModelId;
|
||||||
|
if (matchedModel && recommendedCanonicalIds.has(canonicalId)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (seenCanonicalIds.has(canonicalId)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!matchedModel && normalizedProvider === 'agy') {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
seenCanonicalIds.add(canonicalId);
|
seenCanonicalIds.add(canonicalId);
|
||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -173,6 +173,14 @@ describe('claude preset utils', () => {
|
|||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('preserves newly advertised non-Antigravity models in the supplemental list', () => {
|
||||||
|
const supplementalCodexModels = getSupplementalCatalogModels('codex', MODEL_CATALOGS.codex, [
|
||||||
|
{ id: 'gpt-5.9-codex', owned_by: 'openai' },
|
||||||
|
]);
|
||||||
|
|
||||||
|
expect(supplementalCodexModels).toEqual([{ id: 'gpt-5.9-codex', owned_by: 'openai' }]);
|
||||||
|
});
|
||||||
|
|
||||||
it('does not silently swap Gemini Flash presets to flash-lite', () => {
|
it('does not silently swap Gemini Flash presets to flash-lite', () => {
|
||||||
const availableModels = [{ id: 'gemini-3.1-flash-lite-preview', owned_by: 'google' }];
|
const availableModels = [{ id: 'gemini-3.1-flash-lite-preview', owned_by: 'google' }];
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user