Merge pull request #3807 from jeremymcs/fix/anthropic-api-display-name

fix(ui): display 'anthropic-api' in model selector to distinguish from claude-code
This commit is contained in:
Jeremy McSpadden 2026-04-08 14:27:44 -05:00 committed by GitHub
commit ed303f3fed
2 changed files with 27 additions and 2 deletions

View file

@ -0,0 +1,16 @@
// GSD-2 — Provider display name mapping tests
import { test, describe } from "node:test";
import assert from "node:assert/strict";
import { providerDisplayName } from "../model-selector.js";
describe("providerDisplayName", () => {
test("renames 'anthropic' to 'anthropic-api'", () => {
assert.equal(providerDisplayName("anthropic"), "anthropic-api");
});
test("passes through unmapped providers unchanged", () => {
assert.equal(providerDisplayName("claude-code"), "claude-code");
assert.equal(providerDisplayName("openai"), "openai");
assert.equal(providerDisplayName("bedrock"), "bedrock");
});
});

View file

@ -15,6 +15,15 @@ import { theme } from "../theme/theme.js";
import { DynamicBorder } from "./dynamic-border.js";
import { keyHint } from "./keybinding-hints.js";
/** Display names for providers in the model selector UI. */
const PROVIDER_DISPLAY_NAMES: Record<string, string> = {
anthropic: "anthropic-api",
};
export function providerDisplayName(provider: string): string {
return PROVIDER_DISPLAY_NAMES[provider] ?? provider;
}
function formatTokenCount(count: number): string {
if (count >= 1_000_000) {
const millions = count / 1_000_000;
@ -391,7 +400,7 @@ export class ModelSelectorComponent extends Container implements Focusable {
const ctx = formatTokenCount(item.model.contextWindow);
const ctxBadge = theme.fg("muted", `${ctx}`);
const providerBadge = theme.fg("muted", `[${item.provider}]`);
const providerBadge = theme.fg("muted", `[${providerDisplayName(item.provider)}]`);
const checkmark = isCurrent ? theme.fg("success", " ✓") : "";
let line: string;
@ -447,7 +456,7 @@ export class ModelSelectorComponent extends Container implements Focusable {
if (row.kind === "header") {
// Provider group header — always unselectable
const providerLabel = theme.fg("borderAccent", row.provider);
const providerLabel = theme.fg("borderAccent", providerDisplayName(row.provider));
const count = theme.fg("muted", ` (${row.count})`);
// Add blank line before header if not the very first visible row
if (i > startIndex) {