feat(web): 增加节点图标

This commit is contained in:
v-zhangjc9
2025-07-12 20:46:12 +08:00
parent 60f6b79167
commit 5b9920449d
2 changed files with 8 additions and 1 deletions

View File

@@ -93,7 +93,7 @@ function FlowEditor(props: FlowEditorProps) {
type: 'group',
label: group,
children: NodeRegistry.filter(i => isEqual(group, i.group))
.map(i => ({key: i.key, label: i.name}))
.map(i => ({key: i.key, label: i.name, icon: i.icon})),
})),
onClick: ({key}) => {
try {

View File

@@ -1,4 +1,5 @@
import {has, isEmpty} from 'licia'
import type {JSX} from 'react'
import {getAllIncomerNodeOutputVariables} from './Helper.tsx'
import CodeNode from './node/CodeNode.tsx'
import KnowledgeNode from './node/KnowledgeNode.tsx'
@@ -34,6 +35,7 @@ type NodeDefine = {
key: string,
group: string,
name: string,
icon: JSX.Element,
description: string,
component: any,
checkers: NodeChecker[],
@@ -44,6 +46,7 @@ export const NodeRegistry: NodeDefine[] = [
key: 'llm-node',
group: '普通节点',
name: '大模型',
icon: <i className="fa fa-message"/>,
description: '使用大模型对话',
component: LlmNode,
checkers: [inputVariableChecker],
@@ -52,6 +55,7 @@ export const NodeRegistry: NodeDefine[] = [
key: 'knowledge-node',
group: '普通节点',
name: '知识库',
icon: <i className="fa fa-book-bookmark"/>,
description: '',
component: KnowledgeNode,
checkers: [inputVariableChecker],
@@ -60,6 +64,7 @@ export const NodeRegistry: NodeDefine[] = [
key: 'code-node',
group: '普通节点',
name: '代码执行',
icon: <i className="fa fa-code"/>,
description: '执行自定义的处理代码',
component: CodeNode,
checkers: [inputVariableChecker],
@@ -68,6 +73,7 @@ export const NodeRegistry: NodeDefine[] = [
key: 'switch-node',
group: '逻辑节点',
name: '分支',
icon: <i className="fa fa-code-fork"/>,
description: '根据不同的情况前往不同的分支',
component: SwitchNode,
checkers: [],
@@ -76,6 +82,7 @@ export const NodeRegistry: NodeDefine[] = [
key: 'output-node',
group: '输出节点',
name: '输出',
icon: <i className="fa fa-file"/>,
description: '定义输出变量',
component: OutputNode,
checkers: [inputVariableChecker],