Files
fusion/packages/dashboard/app/utils/providerIconKey.ts
gsxdsm 927f2baf7d FN-8354: add Oh My Pi provider logo
Render the official Oh My Pi mark throughout provider selection and analytics surfaces.

- Add a tokenized OMP SVG icon and provider aliases.
- Infer OMP-tagged model identifiers without misattributing bare models.
- Cover OMP icon rendering and inference with dashboard tests.

Files changed:
 packages/dashboard/app/components/ProviderIcon.tsx | 26 +++++++++++++++++++++-
 .../app/components/__tests__/ProviderIcon.test.tsx | 23 +++++++++++++++++++
 packages/dashboard/app/styles.css                  |  1 +
 .../app/utils/__tests__/providerIconKey.test.ts    |  8 +++++++
 packages/dashboard/app/utils/providerIconKey.ts    |  9 ++++++++
 5 files changed, 66 insertions(+), 1 deletion(-)

Fusion-Task-Id: FN-8354

Fusion-Task-Lineage: 71d5638c-b41e-4960-9391-c7a441d04f51

Co-authored-by: Fusion (runfusion.ai) <noreply@runfusion.ai>
2026-07-18 18:58:44 -07:00

68 lines
3.0 KiB
TypeScript

/*
FNXC:ProviderIcons 2026-06-25-00:00:
Command Center model analytics group rows by model id only, so dashboard model-name surfaces must infer the provider icon from the model/provider text before handing off to ProviderIcon's fallback-safe renderer.
FNXC:ProviderIcons 2026-06-28-20:46:
Standalone GLM model ids such as glm-5.1, glm-4.5-air, and glm-5v-turbo are Z.ai/Zhipu-family models even when the analytics label omits zai/zhipu. Match GLM only at model-id segment boundaries so unrelated words do not hijack the Z.ai provider icon.
*/
const GLM_MODEL_SEGMENT_PATTERN = /(?:^|[/:_-])glm(?:$|[\d._:-]|-[\da-z])/;
const OMP_PROVIDER_SEGMENT_PATTERN = /(?:^|[/:_\s-])omp(?:$|[/:_\s-])/;
const OMP_PROVIDER_NAME_PATTERN = /oh[-\s]my[-\s]pi/;
export function inferProviderIconKey(modelOrProviderName: string): string {
const normalized = modelOrProviderName.toLowerCase();
// Map common provider/model names to their icon keys.
/*
FNXC:ProviderIcons 2026-07-11-00:00:
FN-7818: model-id-shaped Cursor provider strings (cursor, cursor-agent, cursor/<model>) must resolve to the cursor-cli brand icon on model-selection surfaces instead of the generic CPU fallback, mirroring UsageIndicator's local mapping.
Run before broad model-family checks so cursor/gpt-5 stays Cursor-branded instead of OpenAI-branded.
*/
if (normalized.includes("cursor")) {
return "cursor-cli";
}
/*
FNXC:ProviderIcons 2026-07-18-18:24:
FN-8354: omp ACP model ids can contain another vendor model name (for example omp/claude-sonnet-4), but must retain the OMP brand mark on selection and analytics surfaces. Match only an OMP segment or the Oh My Pi name so unrelated strings and untagged model ids keep existing inference/fallback behavior.
*/
if (OMP_PROVIDER_SEGMENT_PATTERN.test(normalized) || OMP_PROVIDER_NAME_PATTERN.test(normalized)) {
return "omp-cli";
}
if (normalized.includes("claude") || normalized.includes("anthropic")) {
return "anthropic";
}
if (normalized.includes("codex") || normalized.includes("openai") || normalized.includes("gpt")) {
return "openai";
}
if (normalized.includes("gemini") || normalized.includes("google") || normalized.includes("antigravity")) {
return "google";
}
if (normalized.includes("ollama")) {
return "ollama";
}
if (normalized.includes("minimax")) {
return "minimax";
}
if (normalized.includes("zai") || normalized.includes("zhipu") || GLM_MODEL_SEGMENT_PATTERN.test(normalized)) {
return "zai";
}
if (normalized.includes("kimi") || normalized.includes("moonshot")) {
return "kimi";
}
if (normalized.includes("bedrock") || normalized.includes("amazon")) {
return "bedrock";
}
if (normalized.includes("xai") || normalized.includes("grok")) {
return "xai";
}
if (normalized.includes("opencode")) {
return "opencode";
}
if (normalized.includes("copilot") || normalized === "github copilot") {
return "github-copilot";
}
// Return the original name as fallback (ProviderIcon will show a default icon).
return modelOrProviderName;
}