import { memo, useCallback, } from 'react' import { useTranslation } from 'react-i18next' import { RiAddLine, } from '@remixicon/react' import cn from '@/utils/classnames' import { ArrowUpRight } from '@/app/components/base/icons/src/vender/line/arrows' import { Check } from '@/app/components/base/icons/src/vender/line/general' import { Tag01 } from '@/app/components/base/icons/src/vender/line/financeAndECommerce' import type { ToolWithProvider } from '@/app/components/workflow/types' import { BlockEnum } from '@/app/components/workflow/types' import BlockIcon from '@/app/components/workflow/block-icon' import Tooltip from '@/app/components/base/tooltip' import Button from '@/app/components/base/button' import { useGetLanguage } from '@/context/i18n' import { useStore as useLabelStore } from '@/app/components/tools/labels/store' import Empty from '@/app/components/tools/add-tool-modal/empty' import type { Tool } from '@/app/components/tools/types' import { CollectionType } from '@/app/components/tools/types' import type { AgentTool } from '@/types/app' import { MAX_TOOLS_NUM } from '@/config' type ToolsProps = { showWorkflowEmpty: boolean tools: ToolWithProvider[] addedTools: AgentTool[] onSelect: (provider: ToolWithProvider, tool: Tool) => void onAuthSetup: (provider: ToolWithProvider) => void } const Blocks = ({ showWorkflowEmpty, tools, addedTools, onSelect, onAuthSetup, }: ToolsProps) => { const { t } = useTranslation() const language = useGetLanguage() const labelList = useLabelStore(s => s.labelList) const addable = addedTools.length < MAX_TOOLS_NUM const renderGroup = useCallback((toolWithProvider: ToolWithProvider) => { const list = toolWithProvider.tools const needAuth = toolWithProvider.allow_delete && !toolWithProvider.is_team_authorization && toolWithProvider.type === CollectionType.builtIn return (