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): keep unbranded app initials readable
chengyongrud8714fe66438
diff --git a/webui/browser/apps-icons.spec.ts b/webui/browser/apps-icons.spec.tsnew file mode 100644index 000000000..8ee73932a--- /dev/null+++ b/webui/browser/apps-icons.spec.ts@@ -0,0 +1,35 @@+import { expect, test } from "@playwright/test";++for (const theme of ["light", "dark"]) {+ for (const logos of ["shown", "hidden"]) {+ test(`unbranded Apps initials stay readable in ${theme} mode with logos ${logos}`, async ({ page }) => {+ await page.route("**/missing-app-icon.svg", (route) => route.fulfill({ status: 404, body: "" }));+ await page.goto(`/browser/fixture.html?case=apps&logos=${logos}`);+ await page.locator("html").evaluate((element, dark) => element.classList.toggle("dark", dark), theme === "dark");++ for (const initials of ["NW", "TM"]) {+ const icon = page.getByText(initials, { exact: true });+ await expect(icon).toBeVisible();+ const contrast = await icon.evaluate((element) => {+ const style = getComputedStyle(element);+ const luminance = (color: string) => {+ const channels = color.match(/[\d.]+/g)!.slice(0, 3).map((value) => {+ const channel = Number(value) / 255;+ return channel <= 0.04045 ? channel / 12.92 : ((channel + 0.055) / 1.055) ** 2.4;+ });+ return 0.2126 * channels[0] + 0.7152 * channels[1] + 0.0722 * channels[2];+ };+ const foreground = luminance(style.color);+ const background = luminance(style.backgroundColor);+ return (Math.max(foreground, background) + 0.05) / (Math.min(foreground, background) + 0.05);+ });+ expect(contrast).toBeGreaterThanOrEqual(4.5);+ await expect(icon).toHaveCSS("width", "36px");+ await expect(icon).toHaveCSS("height", "36px");+ }+ const branded = page.getByText("BE", { exact: true });+ await expect(branded).toHaveCSS("background-color", "rgb(94, 106, 210)");+ await expect(branded).toHaveCSS("color", "rgb(255, 255, 255)");+ });+ }+}diff --git a/webui/browser/fixture.tsx b/webui/browser/fixture.tsxindex aa1132e9f..9e559966e 100644--- a/webui/browser/fixture.tsx+++ b/webui/browser/fixture.tsx@@ -2,6 +2,7 @@ import { useEffect, useState } from "react";import { createRoot } from "react-dom/client";import { createPortal } from "react-dom";import { MessageBubble } from "@/components/MessageBubble";+import { AppsCatalogSettings, DEFAULT_CUSTOM_MCP_FORM } from "@/components/settings/system/AppsSettings";import { ThreadMessages } from "@/components/thread/ThreadMessages";import { ThreadViewport } from "@/components/thread/ThreadViewport";import { PaneWorkbench } from "@/components/workbench/PaneWorkbench";@@ -13,7 +14,7 @@ import { projectThreadEvents } from "@/lib/thread-event-projection";import { Dialog, DialogClose, DialogContent, DialogDescription, DialogTitle, DialogTrigger } from "@/components/ui/dialog";import { TooltipProvider } from "@/components/ui/tooltip";import { initializeI18n } from "@/i18n";-import type { UIMessage } from "@/lib/types";+import type { McpPresetInfo, UIMessage } from "@/lib/types";import "../src/globals.css";const history: UIMessage[] = [@@ -104,9 +105,40 @@ function RailFixture() {/> : viewport(false)}</main>;}+const unbrandedPlugin: McpPresetInfo = {+ name: "plugin-nanobot-workflows", display_name: "Nanobot Workflows", category: "Workflow",+ description: "Engineering workflows", docs_url: "", requires: "Project files", note: "", connection_summary: "",+ transport: "stdio", install_supported: false, installed: true, configured: true,+ enabled: true, available: true, status: "enabled", required_fields: [], source: "agent-plugin",+};+function AppsFixture() {+ const noop = () => {};+ return <main className="mx-auto max-w-4xl p-6"><AppsCatalogSettings+ cliApps={{ apps: [], installed_count: 0 }}+ mcpPresets={{ presets: [+ unbrandedPlugin,+ { ...unbrandedPlugin, name: "test-mcp", display_name: "Test MCP", source: "builtin", logo_url: "/missing-app-icon.svg" },+ { ...unbrandedPlugin, name: "brand-example", display_name: "Brand Example", source: "builtin", brand_color: "#5E6AD2" },+ ], installed_count: 3 }}+ cliAppsLoading={false} mcpPresetsLoading={false} query="" filter="ready"+ cliActionKey={null} mcpActionKey={null} mcpOAuthFlow={null} mcpOAuthPopupBlocked={false}+ mcpOAuthCallbackUrl="" mcpOAuthCompleting={false} mcpOAuthCallbackError={null}+ cliMessage={null} cliError={null} cliFocusName={null} mcpMessage={null} mcpError={null}+ mcpFieldValues={{}} customMcpForm={DEFAULT_CUSTOM_MCP_FORM} mcpConfigImport=""+ showBrandLogos={parameters.get("logos") !== "hidden"} requiresRestartPending={false}+ onQueryChange={noop} onFilterChange={noop} onCliAction={noop} onMcpAction={noop}+ onMcpOAuthConnect={noop} onMcpOAuthCancel={noop} onMcpOAuthOpen={noop}+ onMcpOAuthCallbackUrlChange={noop} onMcpOAuthComplete={noop} onDismissStatus={noop}+ onBackToChat={noop} onMcpFieldChange={noop} onCustomMcpFormChange={noop}+ onMcpConfigImportChange={noop} onSaveCustomMcp={noop} onImportMcpConfig={noop}+ onMcpToolsChange={noop}+ /></main>;+}await initializeI18n();createRoot(document.getElementById("root")!).render(<TooltipProvider>- {parameters.get("case") === "rail"+ {parameters.get("case") === "apps"+ ? <ClientProvider client={railClient} token="fixture"><AppsFixture /></ClientProvider>+ : parameters.get("case") === "rail"? <ClientProvider client={railClient} token="fixture" webuiCapabilities={["webui.prompt-navigation.v1"]}><RailFixture /></ClientProvider>: parameters.get("case") === "history"? <HistoryFixture />diff --git a/webui/src/components/settings/system/AppsSettings.tsx b/webui/src/components/settings/system/AppsSettings.tsxindex d8df8b36c..1c7a37f35 100644--- a/webui/src/components/settings/system/AppsSettings.tsx+++ b/webui/src/components/settings/system/AppsSettings.tsx@@ -1379,7 +1379,8 @@ function McpPresetLogo({return (<spanclassName={cn(- "grid shrink-0 place-items-center font-semibold text-white",+ "grid shrink-0 place-items-center font-semibold",+ preset.brand_color ? "text-white" : "text-muted-foreground",compact? "h-10 w-10 rounded-control text-[12px]": "h-9 w-9 rounded-[10px] text-[12px]",