Skip to content

refactor(web): centralize the duplicated model display-name maps - #501

Merged
gkhngyk merged 1 commit into
mainfrom
chore/model-display-names
Jul 22, 2026
Merged

gkhngyk merged 1 commit into
mainfrom
chore/model-display-names

Conversation

@gkhngyk

@gkhngyk gkhngyk commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

Summary

Closes #435.

The MODEL_DISPLAY_NAME map was copy-pasted on four dashboard pages (insights, citations, prompt detail, competitors — the last with model-level Claude labels), so adding a new model slug meant touching every copy and a missed one produced inconsistent labels.

  • Two maps now live next to the canonical PLATFORM_LABELS in web/src/config/platform-labels.ts:
    • MODEL_PROVIDER_LABELS — provider-level (claude-sonnet-5 → "Claude"), used by insights, citations, and prompt detail.
    • MODEL_LABELS — model-level (claude-sonnet-5 → "Claude Sonnet 5"), spread from the provider map with the four Claude overrides, used by the competitors head-to-head badges.
  • All four local MODEL_DISPLAY_NAME copies and the citations page's byte-identical PLATFORM_LABELS duplicate are deleted; a repo-wide search for MODEL_DISPLAY_NAME returns nothing. Net −87 lines.
  • Rendered labels are unchanged. One nuance, documented in the commit: the prompt-detail page's local PLATFORM_LABELS said "Gemini" for gemini-web where the canonical map says "Google Gemini" — but that branch is unreachable there (its ModelBadge always passes a model slug via modelUsed ?? platform, so the model map wins before the platform map is consulted).

Out of scope: MODEL_TO_PROVIDER in tracking.ts is a provider-routing map, not a display-name map — the issue's acceptance criteria only cover the MODEL_DISPLAY_NAME copies.

Related issue

Closes #435

Type of change

  • refactor — Code change that neither fixes a bug nor adds a feature

How to test

  1. yarn typecheck, yarn lint, yarn test from web/ — all pass.
  2. Visual spot-check with seed data (npm run dev):
    • Insights → AI Model filter dropdown shows "ChatGPT / Claude / Gemini 2.5 Pro …" as before.
    • Citations → platform labels in the header select and tables unchanged.
    • Prompt detail → platform group badges unchanged ("ChatGPT", "Claude", …).
    • Competitors → head-to-head badges keep model-level labels ("Claude Sonnet 5", "Claude Opus").
  3. grep -r MODEL_DISPLAY_NAME web/src → no matches.

Checklist

  • Branch follows the naming convention (feature/, fix/, chore/, docs/) — see CONTRIBUTING.md
  • Commits follow Conventional Commits
  • yarn lint passes (run from web/)
  • yarn typecheck passes (run from web/)
  • yarn format:check passes (run from web/)
  • Changes are focused — one concern per PR

Closes #435.

The MODEL_DISPLAY_NAME map was copy-pasted on the insights, citations,
prompt-detail and competitors pages (the last with model-level Claude
labels), so adding a slug meant touching every copy. Two maps now live
next to the canonical PLATFORM_LABELS in config/platform-labels.ts:
MODEL_PROVIDER_LABELS (provider-level, used by insights / citations /
prompt detail) and MODEL_LABELS (model-level, spread from the former
with the four Claude overrides, used by competitors). All four local
copies and the citations page's PLATFORM_LABELS duplicate are deleted.

Rendered labels are unchanged. The prompt-detail page's local
PLATFORM_LABELS said 'Gemini' for gemini-web where the canonical map
says 'Google Gemini', but that branch is unreachable there: its
ModelBadge always passes a model slug (modelUsed ?? platform), so the
model map wins before the platform map is consulted.
@gkhngyk
gkhngyk merged commit 8f2a12e into main Jul 22, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Centralize the duplicated model display-name maps

1 participant