Command Center token analytics now render standalone GLM model rows with Z.ai provider icons. - Infer Z.ai provider icons for standalone glm-* model ids without matching unrelated text. - Cover GLM icon rendering in Overview token bars and Tokens Area bars/table rows. - Add a patch changeset for the published Fusion package. Files changed: .changeset/fn-7217-zai-glm-icons.md | 7 +++ .../__tests__/CommandCenter.test.tsx | 39 ++++++++++++++++ .../areas/__tests__/TokensArea.test.tsx | 53 ++++++++++++++++++++++ .../app/utils/__tests__/providerIconKey.test.ts | 4 ++ packages/dashboard/app/utils/providerIconKey.ts | 7 ++- 5 files changed, 109 insertions(+), 1 deletion(-) Fusion-Task-Id: FN-7217 Fusion-Task-Lineage: e784413e-2dcf-4b38-ba01-5f9d825e07b8 Co-authored-by: Fusion (runfusion.ai) <noreply@runfusion.ai>
51 lines
2.0 KiB
TypeScript
51 lines
2.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])/;
|
|
|
|
export function inferProviderIconKey(modelOrProviderName: string): string {
|
|
const normalized = modelOrProviderName.toLowerCase();
|
|
|
|
// Map common provider/model names to their icon keys.
|
|
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;
|
|
}
|