feat: mcp tools not support warning

pull/22091/head
Joel 12 months ago
parent b3eca1b664
commit 933194b1f7

@ -279,6 +279,7 @@ const ToolSelector: FC<Props> = ({
</p> </p>
</div> </div>
} }
canChooseMCPTool={canChooseMCPTool}
/> />
)} )}
</PortalToFollowElemTrigger> </PortalToFollowElemTrigger>

@ -17,6 +17,7 @@ import { ToolTipContent } from '@/app/components/base/tooltip/content'
import { InstallPluginButton } from '@/app/components/workflow/nodes/_base/components/install-plugin-button' import { InstallPluginButton } from '@/app/components/workflow/nodes/_base/components/install-plugin-button'
import { SwitchPluginVersion } from '@/app/components/workflow/nodes/_base/components/switch-plugin-version' import { SwitchPluginVersion } from '@/app/components/workflow/nodes/_base/components/switch-plugin-version'
import cn from '@/utils/classnames' import cn from '@/utils/classnames'
import McpToolNotSupportTooltip from '@/app/components/workflow/nodes/_base/components/mcp-tool-not-support-tooltip'
type Props = { type Props = {
icon?: any icon?: any
@ -37,6 +38,7 @@ type Props = {
onInstall?: () => void onInstall?: () => void
versionMismatch?: boolean versionMismatch?: boolean
open: boolean open: boolean
canChooseMCPTool?: boolean,
} }
const ToolItem = ({ const ToolItem = ({
@ -58,11 +60,13 @@ const ToolItem = ({
isError, isError,
errorTip, errorTip,
versionMismatch, versionMismatch,
canChooseMCPTool,
}: Props) => { }: Props) => {
const { t } = useTranslation() const { t } = useTranslation()
const providerNameText = isMCPTool ? providerShowName : providerName?.split('/').pop() const providerNameText = isMCPTool ? providerShowName : providerName?.split('/').pop()
const isTransparent = uninstalled || versionMismatch || isError const isTransparent = uninstalled || versionMismatch || isError
const [isDeleting, setIsDeleting] = useState(false) const [isDeleting, setIsDeleting] = useState(false)
const isShowCanNotChooseMCPTip = isMCPTool && !canChooseMCPTool
return ( return (
<div className={cn( <div className={cn(
@ -90,7 +94,7 @@ const ToolItem = ({
<div className='system-xs-medium text-text-secondary'>{toolLabel}</div> <div className='system-xs-medium text-text-secondary'>{toolLabel}</div>
</div> </div>
<div className='hidden items-center gap-1 group-hover:flex'> <div className='hidden items-center gap-1 group-hover:flex'>
{!noAuth && !isError && !uninstalled && !versionMismatch && ( {!noAuth && !isError && !uninstalled && !versionMismatch && !isShowCanNotChooseMCPTip && (
<ActionButton> <ActionButton>
<RiEqualizer2Line className='h-4 w-4' /> <RiEqualizer2Line className='h-4 w-4' />
</ActionButton> </ActionButton>
@ -107,7 +111,7 @@ const ToolItem = ({
<RiDeleteBinLine className='h-4 w-4' /> <RiDeleteBinLine className='h-4 w-4' />
</div> </div>
</div> </div>
{!isError && !uninstalled && !noAuth && !versionMismatch && showSwitch && ( {!isError && !uninstalled && !noAuth && !versionMismatch && !isShowCanNotChooseMCPTip && showSwitch && (
<div className='mr-1' onClick={e => e.stopPropagation()}> <div className='mr-1' onClick={e => e.stopPropagation()}>
<Switch <Switch
size='md' size='md'
@ -116,6 +120,9 @@ const ToolItem = ({
/> />
</div> </div>
)} )}
{isShowCanNotChooseMCPTip && (
<McpToolNotSupportTooltip />
)}
{!isError && !uninstalled && !versionMismatch && noAuth && ( {!isError && !uninstalled && !versionMismatch && noAuth && (
<Button variant='secondary' size='small' onClick={onAuth}> <Button variant='secondary' size='small' onClick={onAuth}>
{t('tools.notAuthorized')} {t('tools.notAuthorized')}

@ -0,0 +1,22 @@
'use client'
import Tooltip from '@/app/components/base/tooltip'
import { RiAlertFill } from '@remixicon/react'
import type { FC } from 'react'
import React from 'react'
import { useTranslation } from 'react-i18next'
const McpToolNotSupportTooltip: FC = () => {
const { t } = useTranslation()
return (
<Tooltip
popupContent={
<div className='w-[256px]'>
{t('plugin.detailPanel.toolSelector.unsupportedMCPTool')}
</div>
}
>
<RiAlertFill className='size-4 text-text-warning-secondary' />
</Tooltip>
)
}
export default React.memo(McpToolNotSupportTooltip)

@ -93,6 +93,7 @@ const translation = {
unsupportedTitle: 'Unsupported Action', unsupportedTitle: 'Unsupported Action',
unsupportedContent: 'The installed plugin version does not provide this action.', unsupportedContent: 'The installed plugin version does not provide this action.',
unsupportedContent2: 'Click to switch version.', unsupportedContent2: 'Click to switch version.',
unsupportedMCPTool: 'Currently selected agent strategy plugin version does not support MCP tools.',
}, },
configureApp: 'Configure App', configureApp: 'Configure App',
configureModel: 'Configure model', configureModel: 'Configure model',

@ -93,6 +93,7 @@ const translation = {
unsupportedTitle: '不支持的 Action', unsupportedTitle: '不支持的 Action',
unsupportedContent: '已安装的插件版本不提供这个 action。', unsupportedContent: '已安装的插件版本不提供这个 action。',
unsupportedContent2: '点击切换版本', unsupportedContent2: '点击切换版本',
unsupportedMCPTool: '当前选定的 Agent 策略插件版本不支持 MCP 工具。',
}, },
configureApp: '应用设置', configureApp: '应用设置',
configureModel: '模型设置', configureModel: '模型设置',

Loading…
Cancel
Save