Clarify model names in selector

This commit is contained in:
Mohamed Boudra
2026-06-09 14:39:26 +07:00
parent dcdb178468
commit e72b0773e6
5 changed files with 21 additions and 8 deletions

View File

@@ -63,8 +63,6 @@ import {
type ProviderSelectorProvider,
} from "@/provider-selection/provider-selection";
// TODO: this should be configured per provider in the provider manifest
const PROVIDERS_WITH_MODEL_DESCRIPTIONS = new Set(["opencode", "pi"]);
const DESKTOP_PROVIDER_VIEW_MIN_HEIGHT = 220;
const DESKTOP_PROVIDER_VIEW_MAX_HEIGHT = 400;
const DESKTOP_PROVIDER_VIEW_BASE_HEIGHT = 80;
@@ -198,12 +196,10 @@ function ModelRow({
],
);
const showDescription = row.description && PROVIDERS_WITH_MODEL_DESCRIPTIONS.has(row.provider);
return (
<ComboboxItem
label={row.modelLabel}
description={showDescription ? row.description : undefined}
description={row.description}
selected={isSelected}
elevated={elevated}
onPress={onPress}

View File

@@ -56,7 +56,7 @@ describe("combined model selector data", () => {
providerLabel: "Codex",
modelId: "gpt-5.4",
modelLabel: "GPT-5.4",
description: undefined,
description: "gpt-5.4",
isDefault: undefined,
},
],

View File

@@ -47,7 +47,7 @@ function buildModelRows(
providerLabel,
modelId: model.id,
modelLabel: model.label,
description: model.description,
description: model.description ?? model.id,
isDefault: model.isDefault,
}));
}

View File

@@ -1158,6 +1158,11 @@ describe("transformPiModels", () => {
id: "openrouter/google/gemini-2.5-flash-lite",
label: "openrouter/google/gemini_2.5 flash lite",
},
{
provider: "pi",
id: "openrouter/openai/gpt-5.5",
label: "openrouter/OpenAI: GPT-5.5",
},
]),
).toEqual([
{
@@ -1166,6 +1171,12 @@ describe("transformPiModels", () => {
label: "gemini 2.5 flash lite",
description: "openrouter/google/gemini_2.5 flash lite",
},
{
provider: "pi",
id: "openrouter/openai/gpt-5.5",
label: "GPT-5.5",
description: "openrouter/OpenAI: GPT-5.5",
},
]);
});
});

View File

@@ -237,7 +237,13 @@ interface PiSlashCommandInvocation {
type AutoCompactMode = boolean | "toggle" | "unknown";
function normalizePiModelLabel(label: string): string {
return label.trim().replace(/[_\s]+/g, " ");
const normalizedLabel = label.trim().replace(/[_\s]+/g, " ");
const vendorSeparatorIndex = normalizedLabel.indexOf(": ");
if (vendorSeparatorIndex === -1) {
return normalizedLabel;
}
return normalizedLabel.slice(vendorSeparatorIndex + 2).trim();
}
export function transformPiModels(models: AgentModelDefinition[]): AgentModelDefinition[] {