Repository navigation
Description
Problem
The map that turns raw model slugs (claude-sonnet-5, gpt-5-chat-latest, …) into display names is copy-pasted across four dashboard pages:
- https://github.com/ansvisor/ansvisor/blob/main/web/src/app/%5Blocale%5D/(dashboard)/dashboard/insights/page.tsx —
MODEL_DISPLAY_NAME - https://github.com/ansvisor/ansvisor/blob/main/web/src/app/%5Blocale%5D/(dashboard)/dashboard/citations/page.tsx — same map
- https://github.com/ansvisor/ansvisor/blob/main/web/src/app/%5Blocale%5D/(dashboard)/dashboard/prompts/%5Bid%5D/page.tsx — same map
- https://github.com/ansvisor/ansvisor/blob/main/web/src/app/%5Blocale%5D/(dashboard)/dashboard/competitors/page.tsx — a variant with model-level labels ("Claude Sonnet" instead of "Claude")
There's also a MODEL_TO_PROVIDER map in web/src/lib/actions/tracking.ts. When we recently added a new model slug, we had to touch every copy — a missed one means inconsistent labels.
Proposal
Move the maps next to the existing canonical map in web/src/config/platform-labels.ts (which already carries some model slugs) — e.g. one provider-level map (insights/citations/prompt-detail use "Claude") and one model-level map (competitors uses "Claude Sonnet 5"). Import from there everywhere; delete the local copies.
Careful: the four copies are not byte-identical — preserve each page's current rendered labels exactly (this is a refactor, not a copy change).
Acceptance criteria
- One source of truth for model display names; no local
MODEL_DISPLAY_NAMEcopies remain. - Every page renders exactly the same labels as before.
npx tsc --noEmit,npx eslint srcandnpm testpass inweb/.
Good first issue: no behavior change, all locations are listed above, and npm run dev + the seed data (supabase/seed.sql) are enough to verify.
Activity
refactor(web): centralize the duplicated model display-name maps (#501)