chore: in tool picker can not choose mcp

This commit is contained in:
Joel 2025-05-27 15:21:59 +08:00
parent 8d2238d631
commit d1983e4d06
3 changed files with 13 additions and 7 deletions

View File

@ -35,6 +35,7 @@ type AllToolsProps = {
canNotSelectMultiple?: boolean canNotSelectMultiple?: boolean
onSelectMultiple?: (type: BlockEnum, tools: ToolDefaultValue[]) => void onSelectMultiple?: (type: BlockEnum, tools: ToolDefaultValue[]) => void
selectedTools?: ToolValue[] selectedTools?: ToolValue[]
isHideMCPTools?: boolean
} }
const DEFAULT_TAGS: AllToolsProps['tags'] = [] const DEFAULT_TAGS: AllToolsProps['tags'] = []
@ -52,9 +53,10 @@ const AllTools = ({
customTools, customTools,
mcpTools = [], mcpTools = [],
selectedTools, selectedTools,
isHideMCPTools,
}: AllToolsProps) => { }: AllToolsProps) => {
const language = useGetLanguage() const language = useGetLanguage()
const tabs = useToolTabs() const tabs = useToolTabs(isHideMCPTools)
const [activeTab, setActiveTab] = useState(ToolTypeEnum.All) const [activeTab, setActiveTab] = useState(ToolTypeEnum.All)
const [activeView, setActiveView] = useState<ViewType>(ViewType.flat) const [activeView, setActiveView] = useState<ViewType>(ViewType.flat)
const hasFilter = searchText || tags.length > 0 const hasFilter = searchText || tags.length > 0

View File

@ -31,10 +31,9 @@ export const useTabs = () => {
] ]
} }
export const useToolTabs = () => { export const useToolTabs = (isHideMCPTools?: boolean) => {
const { t } = useTranslation() const { t } = useTranslation()
const tabs = [
return [
{ {
key: ToolTypeEnum.All, key: ToolTypeEnum.All,
name: t('workflow.tabs.allTool'), name: t('workflow.tabs.allTool'),
@ -51,9 +50,13 @@ export const useToolTabs = () => {
key: ToolTypeEnum.Workflow, key: ToolTypeEnum.Workflow,
name: t('workflow.tabs.workflowTool'), name: t('workflow.tabs.workflowTool'),
}, },
{ ]
if(!isHideMCPTools) {
tabs.push({
key: ToolTypeEnum.MCP, key: ToolTypeEnum.MCP,
name: 'MCP', name: 'MCP',
}, })
] }
return tabs
} }

View File

@ -83,6 +83,7 @@ const Tabs: FC<TabsProps> = ({
customTools={customTools || []} customTools={customTools || []}
workflowTools={workflowTools || []} workflowTools={workflowTools || []}
mcpTools={mcpTools || []} mcpTools={mcpTools || []}
isHideMCPTools
/> />
) )
} }