fix(team): restore anthropic opus 4.6 option
This commit is contained in:
parent
60f946b75e
commit
cca644a1d2
3 changed files with 62 additions and 4 deletions
|
|
@ -46,6 +46,24 @@ const ANTHROPIC_ALIAS_LABELS = {
|
|||
haiku: 'Haiku 4.5',
|
||||
} as const;
|
||||
|
||||
const ANTHROPIC_VISIBLE_MODEL_FALLBACKS = ['claude-opus-4-7', 'claude-opus-4-7[1m]'] as const;
|
||||
|
||||
const ANTHROPIC_MODEL_ORDER = [
|
||||
'haiku',
|
||||
'claude-haiku-4-5-20251001',
|
||||
'claude-haiku-4-5',
|
||||
'opus',
|
||||
'opus[1m]',
|
||||
'claude-opus-4-7',
|
||||
'claude-opus-4-7[1m]',
|
||||
'claude-opus-4-6',
|
||||
'claude-opus-4-6[1m]',
|
||||
'sonnet',
|
||||
'sonnet[1m]',
|
||||
'claude-sonnet-4-6',
|
||||
'claude-sonnet-4-6[1m]',
|
||||
] as const;
|
||||
|
||||
const TEAM_MODEL_LABEL_OVERRIDES: Record<string, string> = {
|
||||
default: 'Default',
|
||||
...ANTHROPIC_ALIAS_LABELS,
|
||||
|
|
@ -75,6 +93,7 @@ const TEAM_PROVIDER_MODEL_OPTIONS: Record<SupportedProviderId, readonly TeamProv
|
|||
anthropic: [
|
||||
{ value: '', label: 'Default', badgeLabel: 'Default' },
|
||||
{ value: 'opus', label: 'Opus 4.7', badgeLabel: 'Opus 4.7' },
|
||||
{ value: 'claude-opus-4-6', label: 'Opus 4.6', badgeLabel: 'Opus 4.6' },
|
||||
{ value: 'sonnet', label: 'Sonnet 4.6', badgeLabel: 'Sonnet 4.6' },
|
||||
{ value: 'haiku', label: 'Haiku 4.5', badgeLabel: 'Haiku 4.5' },
|
||||
],
|
||||
|
|
@ -117,9 +136,7 @@ const TEAM_PROVIDER_MODEL_OPTIONS: Record<SupportedProviderId, readonly TeamProv
|
|||
};
|
||||
|
||||
const TEAM_PROVIDER_MODEL_ORDER: Record<SupportedProviderId, Map<string, number>> = {
|
||||
anthropic: new Map(
|
||||
TEAM_PROVIDER_MODEL_OPTIONS.anthropic.map((option, index) => [option.value, index])
|
||||
),
|
||||
anthropic: new Map(ANTHROPIC_MODEL_ORDER.map((model, index) => [model, index])),
|
||||
codex: new Map(TEAM_PROVIDER_MODEL_OPTIONS.codex.map((option, index) => [option.value, index])),
|
||||
gemini: new Map(TEAM_PROVIDER_MODEL_OPTIONS.gemini.map((option, index) => [option.value, index])),
|
||||
};
|
||||
|
|
@ -330,6 +347,17 @@ function isRuntimeHiddenTeamModel(
|
|||
);
|
||||
}
|
||||
|
||||
function getSupplementalVisibleModels(
|
||||
providerId: SupportedProviderId,
|
||||
models: readonly string[]
|
||||
): readonly string[] {
|
||||
if (providerId !== 'anthropic') {
|
||||
return models;
|
||||
}
|
||||
|
||||
return [...models, ...ANTHROPIC_VISIBLE_MODEL_FALLBACKS];
|
||||
}
|
||||
|
||||
export function getVisibleTeamProviderModels(
|
||||
providerId: SupportedProviderId,
|
||||
models: readonly string[],
|
||||
|
|
@ -337,7 +365,7 @@ export function getVisibleTeamProviderModels(
|
|||
): string[] {
|
||||
return sortTeamProviderModels(
|
||||
providerId,
|
||||
filterVisibleProviderRuntimeModels(providerId, models)
|
||||
filterVisibleProviderRuntimeModels(providerId, getSupplementalVisibleModels(providerId, models))
|
||||
).filter((model) => !isRuntimeHiddenTeamModel(providerId, model, providerStatus));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -117,6 +117,16 @@ describe('teamModelAvailability', () => {
|
|||
expect(getTeamModelSelectionError('anthropic', 'opus')).toBeNull();
|
||||
});
|
||||
|
||||
it('keeps both Anthropic Opus 4.7 and explicit Opus 4.6 in the fallback selector options', () => {
|
||||
expect(getAvailableTeamProviderModelOptions('anthropic')).toEqual([
|
||||
{ value: '', label: 'Default', badgeLabel: 'Default' },
|
||||
{ value: 'opus', label: 'Opus 4.7', badgeLabel: 'Opus 4.7' },
|
||||
{ value: 'claude-opus-4-6', label: 'Opus 4.6', badgeLabel: 'Opus 4.6' },
|
||||
{ value: 'sonnet', label: 'Sonnet 4.6', badgeLabel: 'Sonnet 4.6' },
|
||||
{ value: 'haiku', label: 'Haiku 4.5', badgeLabel: 'Haiku 4.5' },
|
||||
]);
|
||||
});
|
||||
|
||||
it('keeps known Anthropic full model ids selectable without runtime verification', () => {
|
||||
expect(normalizeTeamModelForUi('anthropic', 'claude-opus-4-7')).toBe('claude-opus-4-7');
|
||||
expect(normalizeTeamModelForUi('anthropic', 'claude-opus-4-7[1m]')).toBe(
|
||||
|
|
|
|||
|
|
@ -23,4 +23,24 @@ describe('teamModelCatalog', () => {
|
|||
'gpt-5.1-codex-max',
|
||||
]);
|
||||
});
|
||||
|
||||
it('adds curated Anthropic Opus 4.7 badges when the runtime list only reports legacy Opus variants', () => {
|
||||
expect(
|
||||
getVisibleTeamProviderModels('anthropic', [
|
||||
'claude-haiku-4-5-20251001',
|
||||
'claude-opus-4-6',
|
||||
'claude-opus-4-6[1m]',
|
||||
'claude-sonnet-4-6',
|
||||
'claude-sonnet-4-6[1m]',
|
||||
])
|
||||
).toEqual([
|
||||
'claude-haiku-4-5-20251001',
|
||||
'claude-opus-4-7',
|
||||
'claude-opus-4-7[1m]',
|
||||
'claude-opus-4-6',
|
||||
'claude-opus-4-6[1m]',
|
||||
'claude-sonnet-4-6',
|
||||
'claude-sonnet-4-6[1m]',
|
||||
]);
|
||||
});
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in a new issue