fix(display): render provider names correctly in Models views

Merged
JU
5mo ago
+159-18

Fixes provider display names that rendered raw or mis-cased: openai → OpenAI, kimi-for-coding → Kimi, google-vertex → Google Vertex, opencode → OpenCode.

Root cause

Two layers:

  • The CLI models report rendered the raw provider id (Cell::new(&entry.provider)) in 6 places — so you saw openai / opencode / google-vertex verbatim.
  • The shared get_provider_display_name mapper's fallback was a naive capitalize-first, producing Google-vertex / Kimi-for-coding for hyphenated ids.

Fix

  • Enriched the canonical mapper (get_provider_display_name): brand-family prefixes (openai*→OpenAI, kimi*→Kimi, copilot→GitHub Copilot), explicit google-vertex/google_vertex→"Google Vertex" (both spellings, since canonical_provider rewrites the hyphen to an underscore), and a smart title-case fallback that splits on -/_/space with a per-word acronym map (AI, GPT, API, LLM, xAI, Vertex). Unknown multi-word providers like some-new-provider now render "Some New Provider".
  • Routed the 6 raw provider cells in run_models_report through the mapper, so the CLI matches the TUI (which already used it). Confirmed no other raw-provider cell renders remain.

Tests (all green)

8 new unit tests covering the four reported cases, openai/kimi families, both google-vertex spellings, the smart multi-word fallback, per-word acronyms, known-brand regressions (Anthropic/xAI/DeepSeek/GitHub Copilot/…), and empty/separator-only edges. cargo build/test/clippy/fmt --check all pass (730 + 122 tests).


Summary by cubic

Fixes provider names across Models views so brands render correctly and consistently (e.g., openai → OpenAI, kimi-for-coding → Kimi, google-vertex → Google Vertex). The CLI now matches the TUI, and unknown ids get clean title-casing.

  • Bug Fixes
    • Routed all entry.provider cells in the models report through get_provider_display_name.
    • Expanded get_provider_display_name with brand-family rules (openai*, kimi*, Copilot variants) and explicit google-vertex/google_vertex → Google Vertex.
    • Replaced naive capitalization with a split-and-title-case fallback with acronym handling (AI, GPT, API, LLM, xAI, Vertex).
    • Added unit tests for reported cases, brand families, both Google Vertex spellings, fallback behavior, and regressions.