Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 19 additions & 9 deletions chatbot/src/ModelProviderIcon.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import React, { useEffect, useId, useRef, useState } from "react";
import HarnessIcon from "./HarnessIcon";
import kimiCodeLogo from "./assets/provider-logos/kimi-code.png";
import { engineBrand } from "./engines.js";
import "./model-provider-icon.css";

// Trusted, bundled brand artwork from Grasp and local assets. Source and
Expand All @@ -11,18 +13,20 @@ const brandSources = import.meta.glob("./assets/provider-logos/*.svg", {
});

const modelBrands = [
[/^(?:claude|anthropic)(?:$|[-_.\s:\d])/i, "claude"],
[/^(?:claude|anthropic|opus|sonnet|haiku|fable)(?:$|[-_.\s:\d])/i, "claude"],
[/^(?:gpt|chatgpt|codex|openai)(?:$|[-_.\s:\d])|^o[1-9]\d?(?:$|[-_.\s:])/i, "openai"],
[/^(?:gemini|google)(?:$|[-_.\s:\d])/i, "google"],
[/^(?:gemini|google)(?:$|[-_.\s:\d])/i, "gemini"],
[/^deepseek(?:$|[-_.\s:\d])/i, "deepseek"],
[/^(?:chatglm|glm|zhipu)(?:$|[-_.\s:\d])/i, "zhipu"],
[/^kimi(?:$|[-_.\s:\d])/i, "kimi"],
[/^kimi(?:$|[-_.\s:\d])|^k[23](?:$|[-_.\s])/i, "kimi"],
[/^moonshot(?:ai)?(?:$|[-_.\s:\d])/i, "moonshot"],
[/^(?:qwen|qvq|alibaba)(?:$|[-_.\s:\d])/i, "qwen"],
[/^(?:hunyuan|tencent)(?:$|[-_.\s:\d])|^hy(?:\d|[-_.\s:])/i, "hunyuan"],
[/^minimax(?:$|[-_.\s:\d])/i, "minimax"],
[/^(?:mimo|xiaomi)(?:$|[-_.\s:\d])/i, "xiaomimimo"],
[/^(?:grok|xai)(?:$|[-_.\s:\d])/i, "xai"],
[/^(?:(?:cursor-)?grok|xai)(?:$|[-_.\s:\d])/i, "xai"],
[/^(?:muse|meta)(?:$|[-_.\s:\d])/i, "meta"],
[/^composer(?:$|[-_.\s:\d])/i, "cursor"],
[/^(?:doubao|seed|seedream|bytedance)(?:$|[-_.\s:\d])/i, "doubao"],
[/^(?:ernie|wenxin|baidu|qianfan)(?:$|[-_.\s:\d])/i, "qianfan"],
[/^(?:zai|z\.ai)(?:$|[-_.\s:\d])/i, "zai"],
Expand All @@ -33,6 +37,7 @@ const fallbackBrands = new Set([
]);
const colorBrands = new Set([
"qwen", "doubao", "siliconflow", "minimax", "zhipu", "hunyuan", "qianfan",
"gemini", "antigravity", "pi", "kimi-code", "meta",
]);

/** A visual label only. Never use inferred brands to route model requests. */
Expand All @@ -41,7 +46,11 @@ export function modelProviderFor(model) {
? [model]
: [model?.family, model?.id, model?.name];
for (const value of values) {
for (const part of String(value || "").trim().split("/").reverse()) {
const text = String(value || "").trim();
const prefix = /^([a-z-]+):/i.exec(text)?.[1];
const id = engineBrand(prefix) ? text.slice(prefix.length + 1) : text;
if ((prefix === "cursor" || model?.engine === "cursor") && /^auto(?:-smart)?$/i.test(id)) return "cursor";
for (const part of id.split("/").reverse()) {
const match = modelBrands.find(([pattern]) => pattern.test(part.trim()));
if (match) return match[1];
}
Expand All @@ -51,7 +60,7 @@ export function modelProviderFor(model) {
}

export function hasProviderLogo(name) {
return Boolean(brandSources[`./assets/provider-logos/${name}.svg`]);
return name === "kimi-code" || Boolean(brandSources[`./assets/provider-logos/${name}.svg`]);
}

function artwork(name, prefix) {
Expand Down Expand Up @@ -117,10 +126,11 @@ export default function ModelProviderIcon({ model, brand: named = "", size = 20,
const identity = `model-provider-${useId().replace(/[^\w-]/g, "")}`;
const [motionKey, setMotionKey] = useState(0);
const brand = named || modelProviderFor(model);
const image = brand === "kimi-code" ? kimiCodeLogo : null;

useEffect(() => {
const element = host.current;
if (!element || !brand) return;
if (!element || !brand || image) return;
const control = element.closest('button, [role="option"], [role="button"], summary, a[href]') || element;
const play = () => {
if (matchMedia("(prefers-reduced-motion: reduce)").matches ||
Expand All @@ -138,13 +148,13 @@ export default function ModelProviderIcon({ model, brand: named = "", size = 20,
control.removeEventListener("pointerdown", press);
control.removeEventListener("focusin", focus);
};
}, [brand]);
}, [brand, image]);

return (
<span ref={host} aria-hidden="true" data-model-provider={brand || "unknown"}
className={`model-provider-icon ${colorBrands.has(brand) ? "model-provider-icon--color" : brand === "kimi" ? "model-provider-icon--kimi" : "model-provider-icon--mono"} ${className}`.trim()}
style={{ width: size, height: size }}>
{brand ? (
{image ? <img src={image} alt="" /> : brand ? (
<>
<BrandSvg name={brand} identity={identity} motionKey={motionKey}
className={brand === "kimi" ? "model-provider-svg--light" : ""} />
Expand Down
10 changes: 5 additions & 5 deletions chatbot/src/assets/provider-logos/README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# Provider logo sources

These SVGs are bundled locally so the credentials UI does not make runtime
requests to an image host.
The interface uses these bundled assets in both chat and configuration.

- `claude.svg`, `codebuddy.svg`, `cursor.svg`, `trae.svg`, `opencode.svg`,
`github.svg`, `gitlab.svg`, `deepseek.svg`, `openrouter.svg`, `google.svg`
Expand All @@ -10,9 +9,9 @@ requests to an image host.
[Simple Icons repository](https://github.com/simple-icons/simple-icons),
and the pinned assets were downloaded from the corresponding
`cdn.jsdelivr.net/npm/simple-icons@v16/icons/<slug>.svg` URLs.
- `pi.svg` is a plain π glyph drawn locally, not from Grasp. It is the same
mark as `web/images/credentials/pi.svg`, bundled here for the chat CLI
selector.
- `pi.svg` is the official primary color mark from the [Pi press kit](https://pi.dev/press-kit).
- `antigravity.svg` is the full-color icon from the [Google Antigravity press assets](https://antigravity.google/press).
- `kimi-code.png` is the icon published by Moonshot AI for the [Kimi Code extension](https://marketplace.visualstudio.com/items?itemName=moonshot-ai.kimi-code).
- `openai.svg` comes from the [OpenAI 2025 logo package](https://cdn.openai.com/brand/OpenAI-Logos-2025.zip).
`codex.svg` uses the same official OpenAI blossom because OpenAI does not
publish a separate Codex mark in that package or in the official Codex CLI
Expand All @@ -37,6 +36,7 @@ requests to an image host.
| `zhipu.svg` | [zhipu-color.svg](https://github.com/lobehub/lobe-icons/blob/7d7d0379f18b114a4009dc5cb85a7c375284f31b/packages/static-svg/icons/zhipu-color.svg) |
| `zai.svg` | [zai.svg](https://github.com/lobehub/lobe-icons/blob/7d7d0379f18b114a4009dc5cb85a7c375284f31b/packages/static-svg/icons/zai.svg) |
| `gemini.svg` | [gemini-color.svg](https://github.com/lobehub/lobe-icons/blob/7d7d0379f18b114a4009dc5cb85a7c375284f31b/packages/static-svg/icons/gemini-color.svg) |
| `meta.svg` | [meta-color.svg](https://github.com/lobehub/lobe-icons/blob/7d7d0379f18b114a4009dc5cb85a7c375284f31b/packages/static-svg/icons/meta-color.svg) |
| `hunyuan.svg` | [hunyuan-color.svg](https://github.com/lobehub/lobe-icons/blob/7d7d0379f18b114a4009dc5cb85a7c375284f31b/packages/static-svg/icons/hunyuan-color.svg) |
| `qianfan.svg` | [baiducloud-color.svg](https://github.com/lobehub/lobe-icons/blob/7d7d0379f18b114a4009dc5cb85a7c375284f31b/packages/static-svg/icons/baiducloud-color.svg) |
| `xiaomimimo.svg` | [xiaomimimo.svg](https://github.com/lobehub/lobe-icons/blob/7d7d0379f18b114a4009dc5cb85a7c375284f31b/packages/static-svg/icons/xiaomimimo.svg);经典 SPA 同一文件复制为 `web/images/credentials/mimo.svg` |
Expand Down
10 changes: 4 additions & 6 deletions chatbot/src/assets/provider-logos/SOURCE.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
# Bundled model brand artwork

Except for `pi.svg`, these SVGs and the accompanying README.md and
LICENSE.lobe-icons were originally copied from the Grasp repository,
web/src/assets/provider-logos. `pi.svg` reuses the local π glyph from
`web/images/credentials/pi.svg`; README.md records this addition. The original Grasp
MIT notice is retained as LICENSE.grasp. README.md records each artwork's own
source and applicable license, including official brand artwork and Simple Icons.
The original model SVGs, README.md, and LICENSE.lobe-icons came from the
Grasp repository at `web/src/assets/provider-logos`. The original Grasp MIT
notice remains in LICENSE.grasp. README.md identifies each asset's source,
including the Pi, Antigravity, and Kimi Code product marks added separately.

ModelProviderIcon.jsx adapts Grasp's visual brand matching and theme treatment.
Its internal light animation is local presentation code. A visual brand match
Expand Down
76 changes: 76 additions & 0 deletions chatbot/src/assets/provider-logos/antigravity.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added chatbot/src/assets/provider-logos/kimi-code.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions chatbot/src/assets/provider-logos/meta.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 6 additions & 1 deletion chatbot/src/assets/provider-logos/pi.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Loading