diff --git a/web/app/components/workflow/block-selector/all-tools.tsx b/web/app/components/workflow/block-selector/all-tools.tsx index 9ef239ce18..1338f4ef1a 100644 --- a/web/app/components/workflow/block-selector/all-tools.tsx +++ b/web/app/components/workflow/block-selector/all-tools.tsx @@ -9,6 +9,7 @@ import type { import { ToolTypeEnum } from './types' import Tools from './tools' import { useToolTabs } from './hooks' +import ViewTypeSelect, { ViewType } from './view-type-select' import cn from '@/utils/classnames' import { useGetLanguage } from '@/context/i18n' @@ -29,6 +30,7 @@ const AllTools = ({ const language = useGetLanguage() const tabs = useToolTabs() const [activeTab, setActiveTab] = useState(ToolTypeEnum.All) + const [activeView, setActiveView] = useState(ViewType.list) const tools = useMemo(() => { let mergedTools: ToolWithProvider[] = [] @@ -49,22 +51,25 @@ const AllTools = ({ }, [activeTab, buildInTools, customTools, workflowTools, searchText, language]) return (
-
- { - tabs.map(tab => ( -
setActiveTab(tab.key)} - > - {tab.name} -
- )) - } +
+
+ { + tabs.map(tab => ( +
setActiveTab(tab.key)} + > + {tab.name} +
+ )) + } +
+
{ }, { key: ToolTypeEnum.BuiltIn, - name: t('workflow.tabs.builtInTool'), + name: t('workflow.tabs.plugin'), }, { key: ToolTypeEnum.Custom, diff --git a/web/app/components/workflow/block-selector/tools.tsx b/web/app/components/workflow/block-selector/tools.tsx index 534fe1499d..a81378dd2d 100644 --- a/web/app/components/workflow/block-selector/tools.tsx +++ b/web/app/components/workflow/block-selector/tools.tsx @@ -5,6 +5,7 @@ import { } from 'react' import { useTranslation } from 'react-i18next' import type { BlockEnum, ToolWithProvider } from '../types' +import { CollectionType } from '../../tools/types' import IndexBar, { groupItems } from './index-bar' import type { ToolDefaultValue } from './types' import ToolItem from './tool-item' @@ -42,7 +43,7 @@ const Blocks = ({ list.map(tool => ( void +} + +const ViewTypeSelect: FC = ({ + viewType, + onChange, +}) => { + const handleChange = useCallback((nextViewType: ViewType) => { + return () => { + if (nextViewType === viewType) + return + onChange(nextViewType) + } + }, [viewType, onChange]) + + return ( +
+
+ +
+
+ +
+
+ ) +} +export default React.memo(ViewTypeSelect) diff --git a/web/i18n/zh-Hans/workflow.ts b/web/i18n/zh-Hans/workflow.ts index 3579ec5df3..2a685f1dc6 100644 --- a/web/i18n/zh-Hans/workflow.ts +++ b/web/i18n/zh-Hans/workflow.ts @@ -197,7 +197,7 @@ const translation = { 'searchTool': '搜索工具', 'tools': '工具', 'allTool': '全部', - 'builtInTool': '内置', + 'plugin': '插件', 'customTool': '自定义', 'workflowTool': '工作流', 'question-understand': '问题理解',