chore: drop comments from fallbackOptions and tighten fallback suppressions

Co-Authored-By: Ishaan Jaffer <155045088+ishaan-berri@users.noreply.github.com>
This commit is contained in:
Devin AI 2026-10-10 02:04:48 +00:00
parent 649fd3c9ea
commit cc4fc1b3a1

View file

@ -41,12 +41,6 @@ export const providerWildcardOption = (slug: string): FallbackOption => {
export const providerWildcardOptions = (modelGroups: ModelGroup[]): FallbackOption[] =>
providerSlugsFor(modelGroups).map(providerWildcardOption);
/**
* Primary picker options: one "All <Provider> Models" wildcard option per
* provider first, then every existing model group. A model group literally
* named like a wildcard (e.g. "openai/*") is folded into its friendly option
* so it is not listed twice.
*/
export const primaryModelOptions = (modelGroups: ModelGroup[]): FallbackOption[] => {
const wildcardValues = new Set(providerWildcardOptions(modelGroups).map((option) => option.value));
const groupOptions = Array.from(new Set(modelGroups.map((modelGroup) => modelGroup.model_group)))
@ -56,23 +50,12 @@ export const primaryModelOptions = (modelGroups: ModelGroup[]): FallbackOption[]
return [...providerWildcardOptions(modelGroups), ...groupOptions];
};
/**
* Fallback-chain options: concrete model groups only. A wildcard entry can
* never be invoked as a fallback target, so anything containing "*" is out.
*/
export const fallbackChainOptions = (modelGroups: ModelGroup[]): FallbackOption[] =>
Array.from(new Set(modelGroups.map((modelGroup) => modelGroup.model_group)))
.filter((name) => !name.includes("*"))
.sort((a, b) => a.localeCompare(b))
.map((name) => ({ label: name, value: name }));
/**
* Resolves the provider slug used to render a model's logo in the fallbacks
* table: the cost map's litellm_provider first, then the model-group info
* providers, then the prefix before the first "/" when it is a known
* provider slug. The last step is what lets keys like "openai/*" or
* "bedrock/us.anthropic.claude-opus-4-8" still get a logo.
*/
export const resolveFallbackProvider = (
model: string,
modelCostMap: Record<string, { litellm_provider?: string }> | null | undefined,
@ -89,11 +72,6 @@ export const resolveFallbackProvider = (
return modelGroupProviderPrefix(model) ?? "";
};
/**
* Display label for a fallback primary key. "openai/*" reads as
* "All OpenAI Models" since the wildcard spelling means nothing to most
* people; everything else keeps its raw name.
*/
export const fallbackPrimaryLabel = (model: string): string => {
if (model.endsWith("/*")) {
const slug = model.slice(0, -2);