diff --git a/ui/src/workflow-canvas/component/NodeMenu.vue b/ui/src/workflow-canvas/component/NodeMenu.vue index 4be12bcbb38..3ff818f6a9a 100644 --- a/ui/src/workflow-canvas/component/NodeMenu.vue +++ b/ui/src/workflow-canvas/component/NodeMenu.vue @@ -22,81 +22,37 @@ const workflowComponentTabs: Array<{ label: string; value: WorkflowComponentTab { label: '智能体', value: 'application' }, ] -const workflowComponentOptions = [ +const workflowComponentGroups = [ { - icon: aiChatIcon, - iconClass: 'bg-primary-gradient', - label: 'AI 对话', - value: WorkflowNodeType.AiChat, + label: 'AI 能力', + list: [ + { icon: aiChatIcon, iconClass: 'bg-primary-gradient', label: 'AI 对话', value: WorkflowNodeType.AiChat }, + { icon: aiChatIcon, iconClass: 'bg-primary-gradient', label: '意图识别', value: WorkflowNodeType.IntentNode }, + ], }, { - icon: aiChatIcon, - iconClass: 'bg-primary-gradient', - label: '意图识别', - value: WorkflowNodeType.IntentNode, + label: '业务逻辑', + list: [ + { icon: aiChatIcon, iconClass: 'bg-purple', label: '判断器', value: WorkflowNodeType.Condition }, + { icon: replyIcon, iconClass: 'bg-warning', label: '指定回复', value: WorkflowNodeType.Reply }, + ], }, - // { - // icon: aiChatIcon, - // iconClass: 'bg-primary-gradient', - // label: '文本转语音', - // value: WorkflowNodeType.TextToSpeechNode, - // }, - // { - // icon: aiChatIcon, - // iconClass: 'bg-primary-gradient', - // label: '语音转文本', - // value: WorkflowNodeType.SpeechToTextNode, - // }, - // { - // icon: aiChatIcon, - // iconClass: 'bg-primary-gradient', - // label: '图片生成', - // value: WorkflowNodeType.ImageGenerateNode, - // }, - // { - // icon: aiChatIcon, - // iconClass: 'bg-primary-gradient', - // label: '图片理解', - // value: WorkflowNodeType.ImageUnderstandNode, - // }, - // { - // icon: aiChatIcon, - // iconClass: 'bg-primary-gradient', - // label: '问题优化', - // value: WorkflowNodeType.Question, - // }, - { - icon: replyIcon, - iconClass: 'bg-warning', - label: '指定回复', - value: WorkflowNodeType.Reply, - }, -] satisfies Array<{ - icon: string - iconClass: string - label: string - value: WorkflowNodeType -}> +] -const filteredComponentOptions = computed(() => { +const filteredComponentGroups = computed(() => { if (activeTab.value !== 'basic') return [] const keyword = searchKeyword.value.trim().toLocaleLowerCase() - if (!keyword) return workflowComponentOptions + if (!keyword) return workflowComponentGroups - return workflowComponentOptions.filter((componentOption) => - componentOption.label.toLocaleLowerCase().includes(keyword), - ) + return workflowComponentGroups + .map((group) => ({ ...group, list: group.list.filter((option) => option.label.toLocaleLowerCase().includes(keyword)) })) + .filter((group) => group.list.length > 0) })