removing horus eye and adding mcp icon (#25323)

Co-authored-by: crazywoola <100913391+crazywoola@users.noreply.github.com>
Co-authored-by: crazywoola <427733928@qq.com>
This commit is contained in:
znn
2025-10-10 14:30:03 +05:30
committed by GitHub
parent 94a07706ec
commit a90b60c36f
3 changed files with 29 additions and 1 deletions

View File

@@ -1,6 +1,8 @@
import { RiCheckLine, RiCloseLine } from '@remixicon/react' import { RiCheckLine, RiCloseLine } from '@remixicon/react'
import { Mcp } from '@/app/components/base/icons/src/vender/other'
import AppIcon from '@/app/components/base/app-icon' import AppIcon from '@/app/components/base/app-icon'
import cn from '@/utils/classnames' import cn from '@/utils/classnames'
import { shouldUseMcpIcon } from '@/utils/mcp'
const iconSizeMap = { const iconSizeMap = {
xs: 'w-4 h-4 text-base', xs: 'w-4 h-4 text-base',
@@ -35,6 +37,7 @@ const Icon = ({
icon={src.content} icon={src.content}
background={src.background} background={src.background}
className='rounded-md' className='rounded-md'
innerIcon={shouldUseMcpIcon(src) ? <Mcp className='h-8 w-8 text-text-primary-on-surface' /> : undefined}
/> />
</div> </div>
) )

View File

@@ -3,6 +3,7 @@ import React, { useRef, useState } from 'react'
import { useTranslation } from 'react-i18next' import { useTranslation } from 'react-i18next'
import { getDomain } from 'tldts' import { getDomain } from 'tldts'
import { RiCloseLine, RiEditLine } from '@remixicon/react' import { RiCloseLine, RiEditLine } from '@remixicon/react'
import { Mcp } from '@/app/components/base/icons/src/vender/other'
import AppIconPicker from '@/app/components/base/app-icon-picker' import AppIconPicker from '@/app/components/base/app-icon-picker'
import type { AppIconSelection } from '@/app/components/base/app-icon-picker' import type { AppIconSelection } from '@/app/components/base/app-icon-picker'
import AppIcon from '@/app/components/base/app-icon' import AppIcon from '@/app/components/base/app-icon'
@@ -17,6 +18,7 @@ import Toast from '@/app/components/base/toast'
import { uploadRemoteFileInfo } from '@/service/common' import { uploadRemoteFileInfo } from '@/service/common'
import cn from '@/utils/classnames' import cn from '@/utils/classnames'
import { useHover } from 'ahooks' import { useHover } from 'ahooks'
import { shouldUseMcpIconForAppIcon } from '@/utils/mcp'
export type DuplicateAppModalProps = { export type DuplicateAppModalProps = {
data?: ToolWithProvider data?: ToolWithProvider
@@ -35,7 +37,7 @@ export type DuplicateAppModalProps = {
onHide: () => void onHide: () => void
} }
const DEFAULT_ICON = { type: 'emoji', icon: '🧿', background: '#EFF1F5' } const DEFAULT_ICON = { type: 'emoji', icon: '🔗', background: '#6366F1' }
const extractFileId = (url: string) => { const extractFileId = (url: string) => {
const match = url.match(/files\/(.+?)\/file-preview/) const match = url.match(/files\/(.+?)\/file-preview/)
return match ? match[1] : null return match ? match[1] : null
@@ -208,6 +210,7 @@ const MCPModal = ({
icon={appIcon.type === 'emoji' ? appIcon.icon : appIcon.fileId} icon={appIcon.type === 'emoji' ? appIcon.icon : appIcon.fileId}
background={appIcon.type === 'emoji' ? appIcon.background : undefined} background={appIcon.type === 'emoji' ? appIcon.background : undefined}
imageUrl={appIcon.type === 'image' ? appIcon.url : undefined} imageUrl={appIcon.type === 'image' ? appIcon.url : undefined}
innerIcon={shouldUseMcpIconForAppIcon(appIcon.type, appIcon.type === 'emoji' ? appIcon.icon : '') ? <Mcp className='h-8 w-8 text-text-primary-on-surface' /> : undefined}
size='xxl' size='xxl'
className='relative cursor-pointer rounded-2xl' className='relative cursor-pointer rounded-2xl'
coverElement={ coverElement={

22
web/utils/mcp.ts Normal file
View File

@@ -0,0 +1,22 @@
/**
* MCP (Model Context Protocol) utility functions
*/
/**
* Determines if the MCP icon should be used based on the icon source
* @param src - The icon source, can be a string URL or an object with content and background
* @returns true if the MCP icon should be used (when it's an emoji object with 🔗 content)
*/
export const shouldUseMcpIcon = (src: any): boolean => {
return typeof src === 'object' && src?.content === '🔗'
}
/**
* Checks if an app icon should use the MCP icon
* @param iconType - The type of icon ('emoji' | 'image')
* @param icon - The icon content (emoji or file ID)
* @returns true if the MCP icon should be used
*/
export const shouldUseMcpIconForAppIcon = (iconType: string, icon: string): boolean => {
return iconType === 'emoji' && icon === '🔗'
}