Clarify model names in selector
This commit is contained in:
@@ -63,8 +63,6 @@ import {
|
|||||||
type ProviderSelectorProvider,
|
type ProviderSelectorProvider,
|
||||||
} from "@/provider-selection/provider-selection";
|
} 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_MIN_HEIGHT = 220;
|
||||||
const DESKTOP_PROVIDER_VIEW_MAX_HEIGHT = 400;
|
const DESKTOP_PROVIDER_VIEW_MAX_HEIGHT = 400;
|
||||||
const DESKTOP_PROVIDER_VIEW_BASE_HEIGHT = 80;
|
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 (
|
return (
|
||||||
<ComboboxItem
|
<ComboboxItem
|
||||||
label={row.modelLabel}
|
label={row.modelLabel}
|
||||||
description={showDescription ? row.description : undefined}
|
description={row.description}
|
||||||
selected={isSelected}
|
selected={isSelected}
|
||||||
elevated={elevated}
|
elevated={elevated}
|
||||||
onPress={onPress}
|
onPress={onPress}
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ describe("combined model selector data", () => {
|
|||||||
providerLabel: "Codex",
|
providerLabel: "Codex",
|
||||||
modelId: "gpt-5.4",
|
modelId: "gpt-5.4",
|
||||||
modelLabel: "GPT-5.4",
|
modelLabel: "GPT-5.4",
|
||||||
description: undefined,
|
description: "gpt-5.4",
|
||||||
isDefault: undefined,
|
isDefault: undefined,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ function buildModelRows(
|
|||||||
providerLabel,
|
providerLabel,
|
||||||
modelId: model.id,
|
modelId: model.id,
|
||||||
modelLabel: model.label,
|
modelLabel: model.label,
|
||||||
description: model.description,
|
description: model.description ?? model.id,
|
||||||
isDefault: model.isDefault,
|
isDefault: model.isDefault,
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1158,6 +1158,11 @@ describe("transformPiModels", () => {
|
|||||||
id: "openrouter/google/gemini-2.5-flash-lite",
|
id: "openrouter/google/gemini-2.5-flash-lite",
|
||||||
label: "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([
|
).toEqual([
|
||||||
{
|
{
|
||||||
@@ -1166,6 +1171,12 @@ describe("transformPiModels", () => {
|
|||||||
label: "gemini 2.5 flash lite",
|
label: "gemini 2.5 flash lite",
|
||||||
description: "openrouter/google/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",
|
||||||
|
},
|
||||||
]);
|
]);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -237,7 +237,13 @@ interface PiSlashCommandInvocation {
|
|||||||
type AutoCompactMode = boolean | "toggle" | "unknown";
|
type AutoCompactMode = boolean | "toggle" | "unknown";
|
||||||
|
|
||||||
function normalizePiModelLabel(label: string): string {
|
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[] {
|
export function transformPiModels(models: AgentModelDefinition[]): AgentModelDefinition[] {
|
||||||
|
|||||||
Reference in New Issue
Block a user