From e8a948cfafacdfe41b2af767711e62fd241b3a85 Mon Sep 17 00:00:00 2001 From: Rdmclin2 Date: Wed, 25 Mar 2026 18:21:36 +0800 Subject: [PATCH] style: replace plugin icon with skill icon (#13252) chore: replace plugin icon with skill icon --- src/components/SkillAvatar/index.tsx | 34 +++++++++ src/features/AgentSkillDetail/index.tsx | 5 +- .../ChatInput/ActionBar/Tools/useControls.tsx | 74 ++++++++----------- src/features/ProfileEditor/AgentTool.tsx | 69 ++++++++--------- .../SkillStore/SkillList/AgentSkillItem.tsx | 10 ++- .../(main)/settings/hooks/useCategory.tsx | 4 +- .../skill/features/AgentSkillItem.tsx | 9 ++- .../settings/skill/features/McpSkillItem.tsx | 10 ++- .../settings/skill/features/SkillList.tsx | 4 +- 9 files changed, 122 insertions(+), 97 deletions(-) create mode 100644 src/components/SkillAvatar/index.tsx diff --git a/src/components/SkillAvatar/index.tsx b/src/components/SkillAvatar/index.tsx new file mode 100644 index 0000000000..6fbb73b030 --- /dev/null +++ b/src/components/SkillAvatar/index.tsx @@ -0,0 +1,34 @@ +'use client'; + +import { Center } from '@lobehub/ui'; +import { SkillsIcon } from '@lobehub/ui/icons'; +import { type CSSProperties, memo } from 'react'; + +interface SkillAvatarProps { + className?: string; + size?: number; + style?: CSSProperties; +} + +const SkillAvatar = memo(({ size = 40, className, style }) => { + return ( +
+ +
+ ); +}); + +SkillAvatar.displayName = 'SkillAvatar'; + +export default SkillAvatar; diff --git a/src/features/AgentSkillDetail/index.tsx b/src/features/AgentSkillDetail/index.tsx index 9b42869081..9be7ba4c17 100644 --- a/src/features/AgentSkillDetail/index.tsx +++ b/src/features/AgentSkillDetail/index.tsx @@ -2,7 +2,7 @@ import { type SkillResourceTreeNode } from '@lobechat/types'; import { Github } from '@lobehub/icons'; -import { ActionIcon, Avatar, Flexbox, Icon } from '@lobehub/ui'; +import { ActionIcon, Flexbox, Icon } from '@lobehub/ui'; import { Skeleton } from 'antd'; import { createStaticStyles, cssVar } from 'antd-style'; import { DotIcon, ExternalLinkIcon } from 'lucide-react'; @@ -10,6 +10,7 @@ import { memo, useMemo, useState } from 'react'; import { useTranslation } from 'react-i18next'; import PublishedTime from '@/components/PublishedTime'; +import SkillAvatar from '@/components/SkillAvatar'; import { useToolStore } from '@/store/tool'; import ContentViewer from './ContentViewer'; @@ -96,7 +97,7 @@ const AgentSkillDetail = memo(({ skillId }) => { {skillDetail && (
- + diff --git a/src/features/ChatInput/ActionBar/Tools/useControls.tsx b/src/features/ChatInput/ActionBar/Tools/useControls.tsx index 666b78fd8e..a3fe7d3fb9 100644 --- a/src/features/ChatInput/ActionBar/Tools/useControls.tsx +++ b/src/features/ChatInput/ActionBar/Tools/useControls.tsx @@ -6,12 +6,11 @@ import { } from '@lobechat/const'; import { type ItemType } from '@lobehub/ui'; import { Avatar, Icon } from '@lobehub/ui'; +import { McpIcon, SkillsIcon } from '@lobehub/ui/icons'; import isEqual from 'fast-deep-equal'; -import { ToyBrick } from 'lucide-react'; import { useMemo } from 'react'; import { useTranslation } from 'react-i18next'; -import PluginAvatar from '@/components/Plugins/PluginAvatar'; import { useCheckPluginsIsInstalled } from '@/hooks/useCheckPluginsIsInstalled'; import { useFetchInstalledPlugins } from '@/hooks/useFetchInstalledPlugins'; import { useAgentStore } from '@/store/agent'; @@ -235,13 +234,10 @@ export const useControls = ({ setUpdating }: { setUpdating: (updating: boolean) const builtinAgentSkillItems = useMemo( () => installedBuiltinSkills.map((skill) => ({ - icon: ( - + icon: skill.avatar ? ( + + ) : ( + ), key: skill.identifier, label: ( @@ -264,9 +260,7 @@ export const useControls = ({ setUpdating }: { setUpdating: (updating: boolean) const marketAgentSkillItems = useMemo( () => marketAgentSkills.map((skill) => ({ - icon: ( - - ), + icon: , key: skill.identifier, label: ( userAgentSkills.map((skill) => ({ - icon: ( - - ), + icon: , key: skill.identifier, label: ( ({ - icon: item?.avatar ? ( - - ) : ( - - ), + icon: + item?.avatar === 'MCP_AVATAR' || !item?.avatar ? ( + + ) : ( + + ), key: item.identifier, label: ( checked.includes(skill.identifier)) .map((skill) => ({ - icon: ( - + icon: skill.avatar ? ( + + ) : ( + ), key: skill.identifier, label: ( @@ -508,11 +498,12 @@ export const useControls = ({ setUpdating }: { setUpdating: (updating: boolean) const enabledCommunityPlugins = communityPlugins .filter((item) => checked.includes(item.identifier)) .map((item) => ({ - icon: item?.avatar ? ( - - ) : ( - - ), + icon: + item?.avatar === 'MCP_AVATAR' || !item?.avatar ? ( + + ) : ( + + ), key: item.identifier, label: ( checked.includes(item.identifier)) .map((item) => ({ - icon: item?.avatar ? ( - - ) : ( - - ), + icon: + item?.avatar === 'MCP_AVATAR' || !item?.avatar ? ( + + ) : ( + + ), key: item.identifier, label: ( checked.includes(skill.identifier)) .map((skill) => ({ - icon: ( - - ), + icon: , key: skill.identifier, label: ( checked.includes(skill.identifier)) .map((skill) => ({ - icon: ( - - ), + icon: , key: skill.identifier, label: ( ( const builtinAgentSkillItems = useMemo( () => installedBuiltinSkills.map((skill) => ({ - icon: ( - + icon: skill.avatar ? ( + + ) : ( + ), key: skill.identifier, label: ( @@ -348,7 +346,7 @@ const AgentTool = memo( const marketAgentSkillItems = useMemo( () => marketAgentSkills.map((skill) => ({ - icon: , + icon: , key: skill.identifier, label: ( ( const userAgentSkillItems = useMemo( () => userAgentSkills.map((skill) => ({ - icon: , + icon: , key: skill.identifier, label: ( ( // Function to generate plugin list items const mapPluginToItem = useCallback( (item: (typeof installedPluginList)[0]) => ({ - icon: item?.avatar ? ( - - ) : ( - - ), + icon: + item?.avatar === 'MCP_AVATAR' || !item?.avatar ? ( + + ) : ( + + ), key: item.identifier, label: ( ( const enabledBuiltinAgentSkillItems = installedBuiltinSkills .filter((skill) => isToolEnabled(skill.identifier)) .map((skill) => ({ - icon: ( - + icon: skill.avatar ? ( + + ) : ( + ), key: skill.identifier, label: ( @@ -615,11 +608,12 @@ const AgentTool = memo( const enabledCommunityPlugins = communityPlugins .filter((item) => plugins.includes(item.identifier)) .map((item) => ({ - icon: item?.avatar ? ( - - ) : ( - - ), + icon: + item?.avatar === 'MCP_AVATAR' || !item?.avatar ? ( + + ) : ( + + ), key: item.identifier, label: ( ( const enabledMarketAgentSkillItems = marketAgentSkills .filter((skill) => isToolEnabled(skill.identifier)) .map((skill) => ({ - icon: , + icon: , key: skill.identifier, label: ( ( const enabledCustomPlugins = customPlugins .filter((item) => plugins.includes(item.identifier)) .map((item) => ({ - icon: item?.avatar ? ( - - ) : ( - - ), + icon: + item?.avatar === 'MCP_AVATAR' || !item?.avatar ? ( + + ) : ( + + ), key: item.identifier, label: ( ( const enabledUserAgentSkillItems = userAgentSkills .filter((skill) => isToolEnabled(skill.identifier)) .map((skill) => ({ - icon: , + icon: , key: skill.identifier, label: ( (({ skill }) => { paddingInline={12} variant={'outlined'} > - + setDetailOpen(true)}> {skill.name} - } size={'small'} /> + } size={'small'} /> {skill.description && ( {skill.description} diff --git a/src/routes/(main)/settings/hooks/useCategory.tsx b/src/routes/(main)/settings/hooks/useCategory.tsx index 756cfc094e..c04e9c37c6 100644 --- a/src/routes/(main)/settings/hooks/useCategory.tsx +++ b/src/routes/(main)/settings/hooks/useCategory.tsx @@ -1,7 +1,7 @@ import { isDesktop } from '@lobechat/const'; import { Avatar } from '@lobehub/ui'; +import { SkillsIcon } from '@lobehub/ui/icons'; import { - Blocks, Brain, BrainCircuit, ChartColumnBigIcon, @@ -138,7 +138,7 @@ export const useCategory = () => { label: t('tab.serviceModel'), }, { - icon: Blocks, + icon: SkillsIcon, key: SettingsTabs.Skill, label: t('tab.skill'), }, diff --git a/src/routes/(main)/settings/skill/features/AgentSkillItem.tsx b/src/routes/(main)/settings/skill/features/AgentSkillItem.tsx index 874e45599a..0918875cb0 100644 --- a/src/routes/(main)/settings/skill/features/AgentSkillItem.tsx +++ b/src/routes/(main)/settings/skill/features/AgentSkillItem.tsx @@ -11,8 +11,9 @@ import { stopPropagation, Tag, } from '@lobehub/ui'; +import { SkillsIcon } from '@lobehub/ui/icons'; import { App, Space } from 'antd'; -import { DownloadIcon, MoreHorizontalIcon, Plus, PuzzleIcon, Trash2 } from 'lucide-react'; +import { DownloadIcon, MoreHorizontalIcon, Plus, Trash2 } from 'lucide-react'; import { lazy, memo, Suspense, useState } from 'react'; import { useTranslation } from 'react-i18next'; @@ -57,7 +58,7 @@ const AgentSkillItem = memo(({ skill }) => { ? t(`tools.builtins.${skill.identifier}.title`, { defaultValue: skill.name }) : skill.name; - const avatar = isBuiltin ? skill.avatar : '🧩'; + const avatar = isBuiltin ? skill.avatar : undefined; // ===== Handlers ===== @@ -218,7 +219,7 @@ const AgentSkillItem = memo(({ skill }) => { onClick={handleOpenDetail} >
- + {avatar ? : }
@@ -227,7 +228,7 @@ const AgentSkillItem = memo(({ skill }) => { > {title} - {!isBuiltin && } size={'small'} />} + {!isBuiltin && } size={'small'} />} {showDisconnected && renderStatus()} diff --git a/src/routes/(main)/settings/skill/features/McpSkillItem.tsx b/src/routes/(main)/settings/skill/features/McpSkillItem.tsx index bad01e4a0f..74bcff9220 100644 --- a/src/routes/(main)/settings/skill/features/McpSkillItem.tsx +++ b/src/routes/(main)/settings/skill/features/McpSkillItem.tsx @@ -1,11 +1,11 @@ 'use client'; -import { Flexbox, Modal } from '@lobehub/ui'; +import { Avatar, Flexbox, Icon, Modal } from '@lobehub/ui'; +import { McpIcon } from '@lobehub/ui/icons'; import { memo, Suspense, useState } from 'react'; import { useTranslation } from 'react-i18next'; import MCPTag from '@/components/Plugins/MCPTag'; -import PluginAvatar from '@/components/Plugins/PluginAvatar'; import PluginTag from '@/components/Plugins/PluginTag'; import SkillSourceTag from '@/components/SkillSourceTag'; import McpDetail from '@/features/MCP/MCPDetail'; @@ -48,7 +48,11 @@ const McpSkillItem = memo( >
- + {avatar && avatar !== 'MCP_AVATAR' ? ( + + ) : ( + + )}
setDetailOpen(true)}> diff --git a/src/routes/(main)/settings/skill/features/SkillList.tsx b/src/routes/(main)/settings/skill/features/SkillList.tsx index b526366524..a9f3e19a80 100644 --- a/src/routes/(main)/settings/skill/features/SkillList.tsx +++ b/src/routes/(main)/settings/skill/features/SkillList.tsx @@ -12,10 +12,10 @@ import { } from '@lobechat/const'; import { type BuiltinSkill, type LobeBuiltinTool } from '@lobechat/types'; import { Center, Empty } from '@lobehub/ui'; +import { SkillsIcon } from '@lobehub/ui/icons'; import { Divider } from 'antd'; import { createStaticStyles } from 'antd-style'; import isEqual from 'fast-deep-equal'; -import { BlocksIcon } from 'lucide-react'; import { memo, useMemo } from 'react'; import { useTranslation } from 'react-i18next'; @@ -291,7 +291,7 @@ const SkillList = memo(() => { if (!hasAnySkills) { return (
- +
);