🤯 LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.
TypeScript agentagent-collaborationagent-harnessloop-engineeringmcppersonal-assistantproactive-agentskillssuper-agenttask-management
♻️ refactor(bot): use the WeCom icon from @lobehub/ui (#23066)
Rdmclin2a3cf511c3048
diff --git a/package.json b/package.jsonindex 9abb771e42b..65009402668 100644--- a/package.json+++ b/package.json@@ -339,7 +339,7 @@"@lobehub/icons": "^6.15.2","@lobehub/market-sdk": "0.46.0","@lobehub/tts": "^6.1.0",- "@lobehub/ui": "^6.13.1",+ "@lobehub/ui": "^6.16.0","@modelcontextprotocol/client": "~2.4.0","@modelcontextprotocol/ext-apps": "^2.0.3","@neondatabase/serverless": "^1.1.0",diff --git a/pnpm-workspace.yaml b/pnpm-workspace.yamlindex 4dd9efe1cd9..93a85948713 100644--- a/pnpm-workspace.yaml+++ b/pnpm-workspace.yaml@@ -63,7 +63,7 @@ allowBuilds:workerd: trueoverrides:- '@lobehub/ui': ^6.13.1+ '@lobehub/ui': ^6.16.0'@lobehub/icons': ^6.0.0# Exact: an editor release can move its lexical version, and the root pins# lexical; lift both together.diff --git a/src/features/AgentChannel/WeComIcon.tsx b/src/features/AgentChannel/WeComIcon.tsxdeleted file mode 100644index 12d0d50e8da..00000000000--- a/src/features/AgentChannel/WeComIcon.tsx+++ /dev/null@@ -1,45 +0,0 @@-import type { SVGProps } from 'react';-import { memo } from 'react';--/**- * WeCom (企业微信) brand mark. `@lobehub/ui/icons` has no WeCom icon yet (checked 6.15.4), so the- * channel catalog would show the card without a logo. The path is Tencent's own `logo-wecom` from- * TDesign Icons (MIT, https://github.com/Tencent/tdesign-icons). Drop this file once- * `@lobehub/ui/icons` ships WeCom and resolve it there like the other platforms.- */-const PATH =- 'm17.326 8.158l-.003-.007a6.6 6.6 0 0 0-1.178-1.674c-1.266-1.307-3.067-2.19-5.102-2.417a9.3 9.3 0 0 0-2.124 0h-.001c-2.061.228-3.882 1.107-5.14 2.405a6.7 6.7 0 0 0-1.194 1.682A5.7 5.7 0 0 0 2 10.657c0 1.106.332 2.218.988 3.201l.006.01c.391.594 1.092 1.39 1.637 1.83l.983.793l-.208.875l.527-.267l.708-.358l.761.225c.467.137.955.227 1.517.29h.005q.515.06 1.026.059c.355 0 .724-.02 1.095-.06a9 9 0 0 0 1.346-.258c.095.7.43 1.337.932 1.81c-.658.208-1.352.358-2.061.436c-.442.048-.883.072-1.312.072q-.627 0-1.253-.072a10.7 10.7 0 0 1-1.861-.36l-2.84 1.438s-.29.131-.44.131c-.418 0-.702-.285-.702-.704c0-.252.067-.598.128-.84l.394-1.653c-.728-.586-1.563-1.544-2.052-2.287A7.76 7.76 0 0 1 0 10.658a7.7 7.7 0 0 1 .787-3.39a8.7 8.7 0 0 1 1.551-2.19c1.61-1.665 3.878-2.73 6.359-3.006a11.3 11.3 0 0 1 2.565 0c2.47.275 4.712 1.353 6.323 3.017a8.6 8.6 0 0 1 1.539 2.192c.466.945.769 1.937.769 2.978a3.06 3.06 0 0 0-2-.005c-.001-.644-.189-1.329-.564-2.09zm4.125 6.977l-.024-.024l-.024-.018l-.024-.018l-.096-.095a4.24 4.24 0 0 1-1.169-2.192q0-.038-.006-.075l-.006-.056l-.035-.144a1.3 1.3 0 0 0-.358-.61a1.386 1.386 0 0 0-1.957 0a1.4 1.4 0 0 0 0 1.963c.191.191.418.311.668.371c.024.012.06.012.084.012q.019 0 .041.006q.023.005.042.006a4.24 4.24 0 0 1 2.231 1.186c.048.048.096.095.131.143a.323.323 0 0 0 .466 0a.35.35 0 0 0 .036-.455m-1.05 4.37l-.025.025c-.119.096-.31.096-.453-.036a.326.326 0 0 1 0-.467c.047-.036.094-.083.141-.13l.002-.002a4.27 4.27 0 0 0 1.187-2.28q.005-.024.006-.043c0-.024 0-.06.012-.084a1.386 1.386 0 0 1 2.326-.67a1.4 1.4 0 0 1 0 1.964c-.167.18-.382.299-.608.359l-.143.036l-.057.005q-.035.006-.075.007a4.2 4.2 0 0 0-2.183 1.173l-.095.096q-.009.01-.018.024t-.018.024m-4.392-1.053l.024.024l.024.018q.015.009.024.018l.096.096a4.25 4.25 0 0 1 1.169 2.19q0 .04.006.076q.005.03.006.057l.035.143c.06.228.18.443.358.611c.537.539 1.42.539 1.957 0a1.4 1.4 0 0 0 0-1.964a1.4 1.4 0 0 0-.668-.371c-.024-.012-.06-.012-.084-.012q-.018 0-.041-.006l-.042-.006a4.25 4.25 0 0 1-2.231-1.185a1.4 1.4 0 0 1-.131-.144a.323.323 0 0 0-.466 0a.325.325 0 0 0-.036.455m1.039-4.358l.024-.024a.32.32 0 0 1 .453.035a.326.326 0 0 1 0 .467c-.047.036-.094.083-.141.13l-.002.002a4.27 4.27 0 0 0-1.187 2.281l-.006.042c0 .024 0 .06-.012.084a1.386 1.386 0 0 1-2.326.67a1.4 1.4 0 0 1 0-1.963c.166-.18.381-.3.608-.36l.143-.035q.026 0 .056-.006q.037-.005.075-.006a4.2 4.2 0 0 0 2.183-1.174l.096-.095l.018-.025z';--/** WeCom brand blue. */-// lobe-design-ignore LOBE-RAW-COLOR: a third-party brand color, not a theme color; @lobehub/ui/icons hard-codes its brand colors the same way-export const WECOM_COLOR_PRIMARY = '#0082EF';--interface WeComIconProps extends SVGProps<SVGSVGElement> {- size?: number | string;-}--const Mono = memo<WeComIconProps>(({ size = '1em', style, ...rest }) => (- <svg- fill="currentColor"- height={size}- style={{ flex: 'none', lineHeight: 1, ...style }}- viewBox="0 0 24 24"- width={size}- xmlns="http://www.w3.org/2000/svg"- {...rest}- >- <title>WeCom</title>- <path d={PATH} />- </svg>-));--const Color = memo<WeComIconProps>(({ style, ...rest }) => (- <Mono style={{ color: WECOM_COLOR_PRIMARY, ...style }} {...rest} />-));--/** Same shape as an `@lobehub/ui/icons` entry: the mono icon, with `.Color` for the brand color. */-export const WeComIcon = Object.assign(Mono, {- Color,- colorPrimary: WECOM_COLOR_PRIMARY,- title: 'WeCom',-});diff --git a/src/features/AgentChannel/const.test.ts b/src/features/AgentChannel/const.test.tsindex 1f71952ba09..1a3251a6b22 100644--- a/src/features/AgentChannel/const.test.ts+++ b/src/features/AgentChannel/const.test.ts@@ -2,14 +2,12 @@ import * as Icons from '@lobehub/ui/icons';import { describe, expect, it } from 'vitest';import { getPlatformIcon } from './const';-import { WECOM_COLOR_PRIMARY, WeComIcon } from './WeComIcon';describe('getPlatformIcon', () => {- it('resolves WeCom by id and by display name, with a brand-color variant', () => {- expect(getPlatformIcon('wecom')).toBe(WeComIcon);- expect(getPlatformIcon('WeCom')).toBe(WeComIcon);- expect('Color' in WeComIcon).toBe(true);- expect(WeComIcon.colorPrimary).toBe(WECOM_COLOR_PRIMARY);+ it('resolves WeCom from @lobehub/ui/icons by id and by display name', () => {+ expect(getPlatformIcon('wecom')).toBe(Icons.WeCom);+ expect(getPlatformIcon('WeCom')).toBe(Icons.WeCom);+ expect('Color' in Icons.WeCom).toBe(true);});it('keeps resolving the other platforms from @lobehub/ui/icons', () => {diff --git a/src/features/AgentChannel/const.ts b/src/features/AgentChannel/const.tsindex baa1bc740d1..e6a769c1f62 100644--- a/src/features/AgentChannel/const.ts+++ b/src/features/AgentChannel/const.ts@@ -3,8 +3,6 @@ import type { FC } from 'react';import type { SerializedPlatformDefinition } from '@/server/services/bot/platforms/types';-import { WeComIcon } from './WeComIcon';-/** Known icon names from @lobehub/ui/icons that correspond to chat platforms. */const ICON_NAMES = ['Discord',@@ -17,14 +15,10 @@ const ICON_NAMES = ['Slack','Telegram','WeChat',+ 'WeCom','WhatsApp',] as const;-/** Platforms whose icon is not in `@lobehub/ui/icons` yet, keyed by lowercased id / name. */-const LOCAL_ICONS: Record<string, FC<any>> = {- wecom: WeComIcon,-};-/** Alias map for platforms whose display name differs from the icon name. */const ICON_ALIASES: Record<string, string> = {feishu: 'Lark',@@ -35,9 +29,6 @@ const ICON_ALIASES: Record<string, string> = {* Accepts either a platform display name (e.g. "Feishu / Lark") or id (e.g. "discord").*/export function getPlatformIcon(nameOrId: string): FC<any> | undefined {- const local = LOCAL_ICONS[nameOrId.toLowerCase()];- if (local) return local;-const alias = ICON_ALIASES[nameOrId.toLowerCase()];if (alias) return (Icons as Record<string, any>)[alias];