Your lightweight open-source personal agent.
Python agent-frameworkai-agentai-agentschatbotchatopsdiscord-botllm-agentsllmslocal-llmmcpmodel-context-protocolmulti-agentopenai-compatibleopenclawpersonal-ai-assistantpythonself-hostedtelegram-bot-ai-assistantwebuiworkflow-automation
fix(webui): normalize provider mark and tile spacing
Xubin Rene45bedc560bc
diff --git a/webui/src/components/settings/models/ProviderSettings.tsx b/webui/src/components/settings/models/ProviderSettings.tsxindex 3ffb597ba..fdd52b385 100644--- a/webui/src/components/settings/models/ProviderSettings.tsx+++ b/webui/src/components/settings/models/ProviderSettings.tsx@@ -1275,6 +1275,7 @@ export function ProviderIcon({const { logoUrl, logoLoaded, onLogoError, onLogoLoad } = useLogoFallback(brand?.logoUrls);const showRemoteLogo = showBrandLogos && Boolean(logoUrl);const showLoadedLogo = showRemoteLogo && logoLoaded;+ const isLogoTile = brand?.logoLayout === "tile" && logoUrl === brand.logoUrl;return (<span@@ -1304,7 +1305,8 @@ export function ProviderIcon({referrerPolicy="no-referrer"draggable={false}className={cn(- "absolute h-7 w-7 object-contain transition-opacity duration-150 motion-reduce:transition-none",+ "absolute object-contain transition-opacity duration-150 motion-reduce:transition-none",+ isLogoTile ? "h-8 w-8" : "h-6 w-6",logoLoaded ? "opacity-100" : "opacity-0",)}onLoad={onLogoLoad}diff --git a/webui/src/lib/provider-brand.ts b/webui/src/lib/provider-brand.tsindex 91115cbab..8716e7fa8 100644--- a/webui/src/lib/provider-brand.ts+++ b/webui/src/lib/provider-brand.ts@@ -3,6 +3,8 @@ export interface ProviderBrand {logoUrls: string[];color: string;initials: string;+ /** The primary asset already includes its own background and safe area. */+ logoLayout?: "tile";}function officialFaviconUrl(domain: string): string {@@ -149,41 +151,51 @@ const PROVIDER_LABEL_ALIASES: Record<string, string> = {};const PROVIDER_BRANDS: Record<string, ProviderBrand> = {- aihubmix: brand("aihubmix.com", "#111827", "AH"),+ aihubmix: { ...brand("aihubmix.com", "#111827", "AH"), logoLayout: "tile" },ant_ling: brand("ant-ling.com", "#7C3AED", "AL"),anthropic: brand("anthropic.com", "#D97757", "A"),assemblyai: brand("assemblyai.com", "#111827", "AA"),atomic_chat: brand("atomic.chat", "#111827", "AC"),azure_openai: brand("azure.microsoft.com", "#0078D4", "AZ"),- bedrock: brand("aws.amazon.com", "#FF9900", "AWS"),+ bedrock: { ...brand("aws.amazon.com", "#FF9900", "AWS"), logoLayout: "tile" },bocha: brand("bochaai.com", "#2563EB", "B"),brave: brand("brave.com", "#FB542B", "B"),byteplus: brand("byteplus.com", "#325CFF", "BP"),dashscope: brand("dashscope.aliyun.com", "#FF6A00", "DS"),deepseek: brand("deepseek.com", "#4D6BFE", "DS"),duckduckgo: brand("duckduckgo.com", "#DE5833", "DDG"),- exa: brand("exa.ai", "#5B5BF6", "E"),+ exa: { ...brand("exa.ai", "#5B5BF6", "E"), logoLayout: "tile" },gemini: brand("gemini.google.com", "#4285F4", "G"),github_copilot: brand("github.com", "#24292F", "GH"),- groq: brand("groq.com", "#F55036", "GQ"),+ groq: {+ ...brand("groq.com", "#F55036", "GQ", ["https://groq.com/favicon.svg"]),+ logoLayout: "tile",+ },huggingface: brand("huggingface.co", "#FF9D00", "HF"),jina: brand("jina.ai", "#7C3AED", "J"),kagi: brand("kagi.com", "#FFB319", "K"),keenable: brand("keenable.ai", "#0EA5E9", "K"),- lm_studio: brand("lmstudio.ai", "#111827", "LM"),+ lm_studio: { ...brand("lmstudio.ai", "#111827", "LM"), logoLayout: "tile" },longcat: brand("longcat.ai", "#4F8CFF", "LC", ["https://s3plus.meituan.net/aigc-media-resources/longcat/yeqian-logo.svg",]),- minimax: brand("minimax.io", "#111827", "MM"),+ minimax: { ...brand("minimax.io", "#111827", "MM"), logoLayout: "tile" },mistral: brand("mistral.ai", "#FA520F", "M"),- modelscope: brand("modelscope.cn", "#5B5BF6", "MS"),- moonshot: brand("moonshot.ai", "#111827", "MS"),+ modelscope: { ...brand("modelscope.cn", "#5B5BF6", "MS"), logoLayout: "tile" },+ moonshot: {+ ...brand("moonshot.ai", "#111827", "MS", [+ "https://statics.kimi.ai/moonshot-ai/favicon.ico",+ ]),+ logoLayout: "tile",+ },novita: brand("novita.ai", "#7C3AED", "N"),- olostep: brand("olostep.com", "#111827", "O"),+ olostep: { ...brand("olostep.com", "#111827", "O"), logoLayout: "tile" },nvidia: brand("nvidia.com", "#76B900", "NV"),ollama: brand("ollama.com", "#111827", "O"),openai: brand("openai.com", "#111827", "AI"),- openrouter: brand("openrouter.ai", "#111827", "OR"),+ openrouter: brand("openrouter.ai", "#111827", "OR", [+ "https://openrouter.ai/brand/logos/transparent/glyph/svg/glyph-grape.svg",+ ]),orcarouter: brand("orcarouter.ai", "#111827", "OR"),ovms: brand("openvino.ai", "#0071C5", "OV"),qianfan: brand("cloud.baidu.com", "#2932E1", "QF"),@@ -193,17 +205,21 @@ const PROVIDER_BRANDS: Record<string, ProviderBrand> = {stepfun: brand("stepfun.com", "#2F6BFF", "SF", ["https://www.stepfun.com/step_favicon.svg",]),- tavily: brand("tavily.com", "#111827", "T"),+ tavily: { ...brand("tavily.com", "#111827", "T"), logoLayout: "tile" },volcengine: brand("volcengine.com", "#1664FF", "VE"),vllm: brand("vllm.ai", "#2563EB", "VL"),xiaomi_mimo: brand("mimo.xiaomi.com", "#FF6900", "MI", ["https://mimo.xiaomi.com/mimo-v2-pro/assets/logo.svg",]),xai: brand("x.ai", "#111827", "xAI"),- zhipu: brand("z.ai", "#155EEF", "Z", [- "https://z-cdn.chatglm.cn/z-ai/static/logo.svg",- "https://www.google.com/s2/favicons?domain=z.ai&sz=64",- ]),+ zhipu: {+ ...brand("z.ai", "#155EEF", "Z", [+ "https://mintcdn.com/zhipu-32152247/B_E8wI-eiNa1QlPV/logo/dark.svg",+ "https://z-cdn.chatglm.cn/z-ai/static/logo.svg",+ "https://www.google.com/s2/favicons?domain=z.ai&sz=64",+ ]),+ logoLayout: "tile",+ },};export function providerBrand(provider: string | null | undefined): ProviderBrand | null {diff --git a/webui/src/tests/provider-brand.test.ts b/webui/src/tests/provider-brand.test.tsindex 7ae981de3..61fcbc6bb 100644--- a/webui/src/tests/provider-brand.test.ts+++ b/webui/src/tests/provider-brand.test.ts@@ -55,7 +55,8 @@ describe("provider brand logos", () => {});it("keeps Zhipu on the current Z.ai brand domain", () => {- expect(providerBrand("zhipu")?.logoUrls[0]).toBe("https://z-cdn.chatglm.cn/z-ai/static/logo.svg");+ expect(providerBrand("zhipu")?.logoUrls[0]).toBe("https://mintcdn.com/zhipu-32152247/B_E8wI-eiNa1QlPV/logo/dark.svg");+ expect(providerBrand("zhipu")?.logoUrls).toContain("https://z-cdn.chatglm.cn/z-ai/static/logo.svg");expect(providerBrand("zhipu")?.logoUrls).toContain("https://www.google.com/s2/favicons?domain=z.ai&sz=64");expect(providerBrand("zhipu")?.logoUrls).toContain("https://z.ai/favicon.ico");expect(providerBrand("zhipu")?.initials).toBe("Z");@@ -78,6 +79,7 @@ describe("provider brand logos", () => {});it("keeps OpenRouter voice settings on the first-party brand domain", () => {+ expect(providerBrand("openrouter")?.logoUrl).toBe("https://openrouter.ai/brand/logos/transparent/glyph/svg/glyph-grape.svg");expect(providerBrand("openrouter")?.logoUrls).toContain("https://openrouter.ai/favicon.ico");expect(providerBrand("openrouter")?.initials).toBe("OR");});diff --git a/webui/src/tests/provider-icon.test.tsx b/webui/src/tests/provider-icon.test.tsxindex 348f4add9..e63461467 100644--- a/webui/src/tests/provider-icon.test.tsx+++ b/webui/src/tests/provider-icon.test.tsx@@ -14,7 +14,7 @@ describe("settings provider icons", () => {expect(icon.className.split(/\s+/).some((value) => value.startsWith("border"))).toBe(false);}- it.each(["openai_codex", "anthropic", "deepseek", "gemini", "xai_grok", "longcat"])(+ it.each(["openai_codex", "anthropic", "deepseek", "gemini", "xai_grok", "longcat", "openrouter"])("shows %s on a single white tile with a small inset after loading",(provider) => {const { container } = render(<ProviderIcon provider={provider} showBrandLogos />);@@ -26,7 +26,7 @@ describe("settings provider icons", () => {expect(icon).toHaveClass("bg-muted");expect(fallback).toHaveTextContent(providerBrand(provider)!.initials);expect(fallback).toHaveClass("opacity-100");- expect(image).toHaveClass("h-7", "w-7", "object-contain", "opacity-0");+ expect(image).toHaveClass("h-6", "w-6", "object-contain", "opacity-0");expect(image).toHaveAttribute("alt", "");fireEvent.load(image);@@ -41,6 +41,30 @@ describe("settings provider icons", () => {},);+ it.each(["aihubmix", "bedrock", "exa", "groq", "lm_studio", "minimax", "minimax_anthropic", "modelscope", "moonshot", "olostep", "tavily", "zhipu"])(+ "does not double-frame %s's primary tile, but preserves unknown fallback assets",+ (provider) => {+ const { container } = render(<ProviderIcon provider={provider} showBrandLogos />);+ const icon = container.firstElementChild!;+ const image = icon.querySelector("img")!;+ expectFootprint(icon);+ expect(image).toHaveAttribute("src", providerBrand(provider)!.logoUrl);+ expect(image).toHaveClass("h-8", "w-8", "object-contain", "opacity-0");++ fireEvent.load(image);+ expect(image).toHaveClass("opacity-100");+ expect(icon).toHaveClass("bg-white");++ fireEvent.error(image);+ expect(image).toHaveAttribute("src", providerBrand(provider)!.logoUrls[1]);+ expect(image).toHaveClass("h-6", "w-6", "object-contain", "opacity-0");+ expect(icon).toHaveClass("bg-muted");+ fireEvent.load(image);+ expectFootprint(icon);+ expect(image).toHaveClass("h-6", "w-6", "opacity-100");+ },+ );+it("keeps its placeholder through alternate URLs and complete image failure", () => {const { container } = render(<ProviderIcon provider="openai_codex" showBrandLogos />);const icon = container.firstElementChild!;