diff --git a/web/app/components/workflow/nodes/llm/components/computer-use-config.tsx b/web/app/components/workflow/nodes/llm/components/computer-use-config.tsx index 289bcd436e..16162f36ae 100644 --- a/web/app/components/workflow/nodes/llm/components/computer-use-config.tsx +++ b/web/app/components/workflow/nodes/llm/components/computer-use-config.tsx @@ -1,9 +1,14 @@ 'use client' import type { FC } from 'react' +import { RiArrowDownSLine } from '@remixicon/react' +import { useBoolean } from 'ahooks' import * as React from 'react' import { useTranslation } from 'react-i18next' import Switch from '@/app/components/base/switch' -import Field from '@/app/components/workflow/nodes/_base/components/field' +import Tooltip from '@/app/components/base/tooltip' +import { BoxGroup } from '@/app/components/workflow/nodes/_base/components/layout' +import { cn } from '@/utils/classnames' +import ReferenceToolConfig from './reference-tool-config' const i18nPrefix = 'nodes.llm.computerUse' @@ -19,20 +24,56 @@ const ComputerUseConfig: FC = ({ onChange, }) => { const { t } = useTranslation() + const [isCollapsed, { toggle: toggleCollapsed }] = useBoolean(false) return ( - - )} - /> + +
+
+
+
+ {t(`${i18nPrefix}.title`, { ns: 'workflow' })} +
+ + +
+ +
+ {!isCollapsed && ( +
+
+ {t(`${i18nPrefix}.referenceTools`, { ns: 'workflow' })} +
+ +
+ )} +
+
) } diff --git a/web/app/components/workflow/nodes/llm/components/reference-tool-config.tsx b/web/app/components/workflow/nodes/llm/components/reference-tool-config.tsx new file mode 100644 index 0000000000..6b145006b4 --- /dev/null +++ b/web/app/components/workflow/nodes/llm/components/reference-tool-config.tsx @@ -0,0 +1,110 @@ +'use client' +import type { FC } from 'react' +import { RiArrowDownSLine } from '@remixicon/react' +import * as React from 'react' +import { DefaultToolIcon } from '@/app/components/base/icons/src/public/other' +import Switch from '@/app/components/base/switch' +import { cn } from '@/utils/classnames' + +type ToolPermissionAction = { + id: string + label: string + defaultEnabled: boolean +} + +type ToolPermissionProvider = { + id: string + label: string + actions?: ToolPermissionAction[] +} + +type ReferenceToolConfigProps = { + readonly: boolean + enabled: boolean +} + +const ReferenceToolConfig: FC = ({ + readonly, + enabled, +}) => { + const isDisabled = readonly || !enabled + const providers: ToolPermissionProvider[] = [ + { + id: 'duckduckgo', + label: 'DuckDuckGo', + actions: [ + { + id: 'duckduckgo-ai-chat', + label: 'DuckDuckGo AI Chat', + defaultEnabled: true, + }, + { + id: 'duckduckgo-image-search', + label: 'DuckDuckGo Image Search', + defaultEnabled: true, + }, + { + id: 'duckduckgo-search', + label: 'DuckDuckGo Search', + defaultEnabled: true, + }, + { + id: 'duckduckgo-translate', + label: 'DuckDuckGo Translate', + defaultEnabled: false, + }, + ], + }, + { + id: 'web-search', + label: 'Web Search', + }, + { + id: 'stability', + label: 'Stability', + }, + ] + + return ( +
+ {providers.map(provider => ( +
+
+
+
+ +
+
+ {provider.label} +
+ +
+
+ {provider.actions?.map(action => ( +
+
+
+ + {action.label} + +
+ +
+ ))} +
+ ))} +
+ ) +} + +export default React.memo(ReferenceToolConfig) diff --git a/web/i18n/en-US/workflow.json b/web/i18n/en-US/workflow.json index 5c1ccbb266..931173a2e7 100644 --- a/web/i18n/en-US/workflow.json +++ b/web/i18n/en-US/workflow.json @@ -667,8 +667,9 @@ "nodes.llm.addContext": "Add Context", "nodes.llm.addMessage": "Add Message", "nodes.llm.advancedSettings": "Advanced Settings", + "nodes.llm.computerUse.referenceTools": "Reference Tools", "nodes.llm.computerUse.title": "Computer Use", - "nodes.llm.computerUse.tooltip": "Allow the model to operate a sandboxed computer.", + "nodes.llm.computerUse.tooltip": "Manage the runtime filesystem and tool access for your agent.", "nodes.llm.context": "context", "nodes.llm.contextBlock": "Context Block", "nodes.llm.contextTooltip": "You can import Knowledge as context", diff --git a/web/i18n/zh-Hans/workflow.json b/web/i18n/zh-Hans/workflow.json index c89f945481..d42dde2937 100644 --- a/web/i18n/zh-Hans/workflow.json +++ b/web/i18n/zh-Hans/workflow.json @@ -660,8 +660,9 @@ "nodes.listFilter.selectVariableKeyPlaceholder": "选择子变量的 Key", "nodes.llm.addContext": "添加上下文", "nodes.llm.addMessage": "添加消息", + "nodes.llm.computerUse.referenceTools": "引用工具", "nodes.llm.computerUse.title": "计算机使用", - "nodes.llm.computerUse.tooltip": "允许模型操作沙箱计算机。", + "nodes.llm.computerUse.tooltip": "管理代理的运行时文件系统与工具访问权限。", "nodes.llm.context": "上下文", "nodes.llm.contextBlock": "上下文块", "nodes.llm.contextTooltip": "您可以导入知识库作为上下文",