From ef1a12ab74a7b78177d1a6a0e21c3337cd53b6f2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=91=A3=E5=AE=8F=E5=87=AF?= Date: Wed, 17 Jun 2026 13:11:27 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20zzJC/zzXD=20=E5=B7=A6=E6=A0=8F=E6=99=BA?= =?UTF-8?q?=E8=83=BD=E4=BD=93=E5=88=97=E8=A1=A8=E5=AF=B9=E9=BD=90=E5=85=A8?= =?UTF-8?q?=E9=87=8F=E7=89=88=E5=BD=A9=E8=89=B2=E5=8D=A1=E7=89=87=E6=A0=B7?= =?UTF-8?q?=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 抽出共享配色助手 agent-icon-color.ts(按 id 散列、分浅色/深蓝主题), general-qa-sidebar 与 agent-module-sidebar 共用 - AgentModuleSidebar:背景改白底、去毛玻璃;智能体项改为彩色渐变图标卡片 (图标+名称+两行简介+选中态主色描边/右侧主色条);分组标题与聊天记录配色统一 - 保留按类型分组/折叠与会话过滤逻辑 Co-Authored-By: Claude Opus 4.8 (1M context) --- .../components/workspace/agent-icon-color.ts | 35 ++ .../workspace/agents/agent-module-sidebar.tsx | 83 ++- .../workspace/general-qa-sidebar.tsx | 30 +- frontend-web/src/pages/MenuManagementPage.tsx | 473 ++++++++++++++---- 4 files changed, 472 insertions(+), 149 deletions(-) create mode 100644 frontend-web/src/components/workspace/agent-icon-color.ts diff --git a/frontend-web/src/components/workspace/agent-icon-color.ts b/frontend-web/src/components/workspace/agent-icon-color.ts new file mode 100644 index 00000000..5f78c7e6 --- /dev/null +++ b/frontend-web/src/components/workspace/agent-icon-color.ts @@ -0,0 +1,35 @@ +/** + * 智能体图标底色 —— 按 id 稳定散列到一组主题色,复刻参考图的彩色方块。 + * + * 浅色模式沿用原高彩度彩色(不改);深蓝主题改用《深蓝 UI 规范》§1.1.7/§1.1.8 的蓝-青系 + * (docs/ui规范-深蓝,克制、不刺眼),仅深蓝主题下生效,互不影响。 + * + * 全量版通用问答左栏(GeneralQaSidebar)与 zzJC/zzXD 模块左栏(AgentModuleSidebar)共用, + * 保证彩色卡片配色完全一致。 + */ + +const AGENT_COLORS_LIGHT = [ + { from: "#fb7185", to: "#ef4444" }, + { from: "#60a5fa", to: "#3b82f6" }, + { from: "#fbbf24", to: "#f59e0b" }, + { from: "#34d399", to: "#10b981" }, + { from: "#a78bfa", to: "#8b5cf6" }, +] as const; + +const AGENT_COLORS_DARK = [ + { from: "#4096FF", to: "#1677FF" }, // 蓝(链接蓝 → 主色) + { from: "#36CFC9", to: "#13C2C2" }, // 青(辅色) + { from: "#6388FF", to: "#0958D9" }, // 紫蓝(装饰紫 → 主色深一档) + { from: "#5CDBD3", to: "#08979C" }, // 浅青 → 深青 + { from: "#69B1FF", to: "#003EB3" }, // 浅蓝 → 主色按下 +] as const; + +/** 按 agent id 稳定散列出一对渐变色(from → to)。`isDark` 切换深蓝/浅色调色板。 */ +export function agentColor(id: string, isDark: boolean) { + let hash = 0; + for (let i = 0; i < id.length; i++) { + hash = (hash * 31 + id.charCodeAt(i)) >>> 0; + } + const palette = isDark ? AGENT_COLORS_DARK : AGENT_COLORS_LIGHT; + return palette[hash % palette.length]!; +} diff --git a/frontend-web/src/components/workspace/agents/agent-module-sidebar.tsx b/frontend-web/src/components/workspace/agents/agent-module-sidebar.tsx index 2266b48d..a30f74af 100644 --- a/frontend-web/src/components/workspace/agents/agent-module-sidebar.tsx +++ b/frontend-web/src/components/workspace/agents/agent-module-sidebar.tsx @@ -5,6 +5,8 @@ import Link from "next/link"; import { usePathname } from "next/navigation"; import { useMemo, useState } from "react"; +import { agentColor } from "@/components/workspace/agent-icon-color"; +import { useTheme } from "@/contexts/ThemeContext"; import { useAgents } from "@/core/agents"; import type { Agent } from "@/core/agents"; import { useAgentModuleConfig } from "@/core/system-settings/hooks"; @@ -125,6 +127,9 @@ export function AgentModuleSidebar({ }) { const routeBase = useRouteBase(); const pathname = usePathname(); + // 智能体图标配色分主题:深蓝主题用规范蓝-青系,其它(浅色)保持原高彩度色,互不影响。 + const { theme } = useTheme(); + const isDark = theme === "dark"; const { agents } = useAgents(); const { data: threads = [] } = useThreads(); const { data: moduleConfig } = useAgentModuleConfig(moduleKey); @@ -165,7 +170,8 @@ export function AgentModuleSidebar({ }); return ( -