|
@@ -12,65 +12,73 @@ import PopoverNode from "./PopoverNode";
|
|
|
import "./NoticeNode";
|
|
|
import Custom from "./Custom";
|
|
|
|
|
|
+import start from "@/assets/wf_icon_start.gif";
|
|
|
+import end from "@/assets/wf_icon_end.gif";
|
|
|
+import autohandle from "@/assets/wf_icon_autohandle.gif";
|
|
|
+import and from "@/assets/wf_icon_and.gif";
|
|
|
+import handle from "@/assets/wf_icon_handle.gif";
|
|
|
+import judge from "@/assets/wf_icon_judge.gif";
|
|
|
+import or from "@/assets/wf_icon_or.gif";
|
|
|
+
|
|
|
// 通用连接桩
|
|
|
const ports = {
|
|
|
groups: {
|
|
|
top: {
|
|
|
- position: 'top',
|
|
|
+ position: "top",
|
|
|
attrs: {
|
|
|
circle: {
|
|
|
r: 4,
|
|
|
magnet: true,
|
|
|
- stroke: '#5F95FF',
|
|
|
+ stroke: "#5F95FF",
|
|
|
strokeWidth: 1,
|
|
|
- fill: '#fff',
|
|
|
+ fill: "#fff",
|
|
|
style: {
|
|
|
- visibility: 'hidden',
|
|
|
+ visibility: "hidden",
|
|
|
},
|
|
|
},
|
|
|
},
|
|
|
},
|
|
|
right: {
|
|
|
- position: 'right',
|
|
|
+ position: "right",
|
|
|
attrs: {
|
|
|
circle: {
|
|
|
r: 4,
|
|
|
magnet: true,
|
|
|
- stroke: '#5F95FF',
|
|
|
+ stroke: "#5F95FF",
|
|
|
strokeWidth: 1,
|
|
|
- fill: '#fff',
|
|
|
+ fill: "#fff",
|
|
|
style: {
|
|
|
- visibility: 'hidden',
|
|
|
+ visibility: "hidden",
|
|
|
},
|
|
|
},
|
|
|
},
|
|
|
},
|
|
|
bottom: {
|
|
|
- position: 'bottom',
|
|
|
+ position: "bottom",
|
|
|
attrs: {
|
|
|
circle: {
|
|
|
r: 4,
|
|
|
magnet: true,
|
|
|
- stroke: '#5F95FF',
|
|
|
+ stroke: "#5F95FF",
|
|
|
strokeWidth: 1,
|
|
|
- fill: '#fff',
|
|
|
+ fill: "#fff",
|
|
|
style: {
|
|
|
- visibility: 'hidden',
|
|
|
+ visibility: "hidden",
|
|
|
},
|
|
|
},
|
|
|
},
|
|
|
},
|
|
|
left: {
|
|
|
- position: 'left',
|
|
|
+ position: "left",
|
|
|
attrs: {
|
|
|
circle: {
|
|
|
r: 4,
|
|
|
magnet: true,
|
|
|
- stroke: '#5F95FF',
|
|
|
+ stroke: "#5F95FF",
|
|
|
strokeWidth: 1,
|
|
|
- fill: '#fff',
|
|
|
+ fill: "#fff",
|
|
|
style: {
|
|
|
- visibility: 'hidden',
|
|
|
+ visibility: "hidden",
|
|
|
},
|
|
|
},
|
|
|
},
|
|
@@ -78,81 +86,323 @@ const ports = {
|
|
|
},
|
|
|
items: [
|
|
|
{
|
|
|
- group: 'top',
|
|
|
+ group: "top",
|
|
|
},
|
|
|
{
|
|
|
- group: 'right',
|
|
|
+ group: "right",
|
|
|
},
|
|
|
{
|
|
|
- group: 'bottom',
|
|
|
+ group: "bottom",
|
|
|
},
|
|
|
{
|
|
|
- group: 'left',
|
|
|
+ group: "left",
|
|
|
},
|
|
|
],
|
|
|
-}
|
|
|
+};
|
|
|
|
|
|
export const nodes = [
|
|
|
- { name: "start-node", component: Start, type: NodeType.START, data: { name: '开始'} },
|
|
|
- { name: "and-node", component: And, type: NodeType.AND, data: { name: '与'} },
|
|
|
- { name: "autohandle-node", component: AutoHandle, type: NodeType.AUTO_PROCESS, data: { name: '自动处理'} },
|
|
|
- { name: "decision-node", component: Decision, type: NodeType.DECISION, data: { name: '判断'} },
|
|
|
- { name: "end-node", component: End, type: NodeType.END, data: { name: '结束'} },
|
|
|
- { name: "handle-node", component: Handle, type: NodeType.PROCESS, data: { name: '处理'} },
|
|
|
- { name: "link-node", component: Link, type: NodeType.LINK, data: { name: '连接'} }
|
|
|
+ {
|
|
|
+ name: "start-node",
|
|
|
+ component: Start,
|
|
|
+ type: NodeType.START,
|
|
|
+ data: { name: "开始" },
|
|
|
+ },
|
|
|
+ {
|
|
|
+ name: "and-node",
|
|
|
+ component: And,
|
|
|
+ type: NodeType.AND,
|
|
|
+ data: { name: "与" },
|
|
|
+ },
|
|
|
+ {
|
|
|
+ name: "autohandle-node",
|
|
|
+ component: AutoHandle,
|
|
|
+ type: NodeType.AUTO_PROCESS,
|
|
|
+ data: { name: "自动处理" },
|
|
|
+ },
|
|
|
+ {
|
|
|
+ name: "decision-node",
|
|
|
+ component: Decision,
|
|
|
+ type: NodeType.DECISION,
|
|
|
+ data: { name: "判断" },
|
|
|
+ },
|
|
|
+ {
|
|
|
+ name: "end-node",
|
|
|
+ component: End,
|
|
|
+ type: NodeType.END,
|
|
|
+ data: { name: "结束" },
|
|
|
+ },
|
|
|
+ {
|
|
|
+ name: "handle-node",
|
|
|
+ component: Handle,
|
|
|
+ type: NodeType.PROCESS,
|
|
|
+ data: { name: "处理" },
|
|
|
+ },
|
|
|
+ {
|
|
|
+ name: "link-node",
|
|
|
+ component: Link,
|
|
|
+ type: NodeType.LINK,
|
|
|
+ data: { name: "连接" },
|
|
|
+ },
|
|
|
+];
|
|
|
+
|
|
|
+export const nodeItems = [
|
|
|
+ { key: NodeType.START, name: "start-node", icon: start, text: "开始" },
|
|
|
+ { key: NodeType.PROCESS, name: "handle-node", icon: handle, text: "处理" },
|
|
|
+ {
|
|
|
+ key: NodeType.AUTO_PROCESS,
|
|
|
+ name: "autohandle-node",
|
|
|
+ icon: autohandle,
|
|
|
+ text: "自动处理",
|
|
|
+ },
|
|
|
+ { key: NodeType.DECISION, name: "decision-node", icon: or, text: "判断" },
|
|
|
+ { key: NodeType.AND, name: "and-node", icon: and, text: "与" },
|
|
|
+ { key: NodeType.LINK, name: "link-node", icon: judge, text: "连接" },
|
|
|
+ { key: NodeType.END, name: "end-node", icon: end, text: "结束" },
|
|
|
];
|
|
|
|
|
|
export const aiNode = [
|
|
|
- {port: {in: 1, out: 1}, style: {}, color: '#00b2b2', icon: 'icon-wentifenlei', name: 'ai-category', component: Custom, data: { name: '问题分类'}},
|
|
|
- {port: {in: 1, out: 1}, style: {}, color: '#00b2b2', icon: 'icon-xunhuan1', name: 'ai-loop', component: Custom, data: { name: '循环分支'}},
|
|
|
- {port: {in: 1, out: 1}, style: {}, color: '#ff811a', icon: 'icon-shiyongwendang', name: 'ai-doc', component: Custom, data: { name: '文档提取器'}},
|
|
|
- {port: {in: 1, out: 1}, style: {}, color: '#3071f3', icon: 'icon-http', name: 'ai-http', component: Custom, data: { name: 'HTTP'}},
|
|
|
- {port: {in: 1, out: 0}, style: {borderTopRightRadius: 36, borderBottomRightRadius: 36}, color: '#d37d1d', icon: 'icon-flag', name: 'ai-end', component: Custom, data: { name: '结束'}},
|
|
|
- {port: {in: 0, out: 1}, style: {borderTopLeftRadius: 36, borderBottomLeftRadius: 36}, color: '#5c62ff', icon: 'icon-message', name: 'ai-start', component: Custom, data: { name: '开始'}},
|
|
|
- {port: {in: 1, out: 1}, style: {}, color: '#00b2b2', icon: 'icon-daima', name: 'ai-code', component: Custom, data: { name: '代码'}},
|
|
|
- {port: {in: 1, out: 1}, style: {}, color: '#00b2b2', icon: 'icon-tiaojianfenzhi', name: 'ai-if', component: Custom, data: { name: '条件分支'}},
|
|
|
- {port: {in: 1, out: 1}, style: {}, color: '#00b2b2', icon: 'icon-xunhuan', name: 'ai-iteration', component: Custom, data: { name: '迭代'}},
|
|
|
- {port: {in: 1, out: 1}, style: {}, color: '#ff811a', icon: 'icon-data-update', name: 'ai-adddata', component: Custom, data: { name: '数据新增'}},
|
|
|
- {port: {in: 1, out: 1}, style: {}, color: '#ff811a', icon: 'icon-data-Inquire', name: 'ai-querydata', component: Custom, data: { name: '数据查询'}},
|
|
|
- {port: {in: 1, out: 1}, style: {}, color: '#ff811a', icon: 'icon-server-update-full', name: 'ai-updatedata', component: Custom, data: { name: '数据更新'}},
|
|
|
- {port: {in: 1, out: 1}, style: {}, color: '#ff811a', icon: 'icon-server-update', name: 'ai-deldata', component: Custom, data: { name: '数据删除'}},
|
|
|
- {port: {in: 1, out: 1}, style: {}, color: '#ff811a', icon: 'icon-book', name: 'ai-know', component: Custom, data: { name: '知识检索'}},
|
|
|
- {port: {in: 1, out: 1}, style: {}, color: '#ff811a', icon: 'icon-image', name: 'ai-ocr', component: Custom, data: { name: '图像识别'}},
|
|
|
- {port: {in: 1, out: 1}, style: {}, color: '#00b2b2', icon: 'icon-liebiaoguolvqi', name: 'ai-list', component: Custom, data: { name: '列表操作'}},
|
|
|
- {port: {in: 1, out: 1}, style: {}, color: '#ca60fe', icon: 'icon-flow', name: 'ai-flow', component: Custom, data: { name: '工作流'}},
|
|
|
- {port: {in: 1, out: 1}, style: {}, color: '#00b2b2', icon: 'icon-bianliangfuzhi', name: 'ai-equal', component: Custom, data: { name: '变量赋值'}},
|
|
|
- {port: {in: 1, out: 1}, style: {}, color: '#1d44d3', icon: 'icon-zhinengti-opsasda', name: 'ai-llm', component: Custom, data: { name: '逻辑处理模型LLM', type: 'model'}, width: 256, height: 100},
|
|
|
- {port: {in: 1, out: 1}, style: {}, color: '#00b2b2', icon: 'icon-kaifangAImoxingku', name: 'ai-params', component: Custom, data: { name: '参数提取'}},
|
|
|
- {port: {in: 1, out: 1}, style: {}, color: '#00b2b2', icon: 'icon-canshutiqu', name: 'ai-var', component: Custom, data: { name: '变量聚合'}},
|
|
|
- {port: {in: 1, out: 1}, style: {}, color: '#00b2b2', icon: 'icon-chajian1', name: 'ai-var', component: Custom, data: { name: '扩展插件', type: 'model'}, width: 256, height: 100},
|
|
|
- {port: {in: 1, out: 1}, style: {}, color: '#4d6bfe', icon: 'icon-deepseek', name: 'ai-model', component: Custom, data: { name: 'DeepSeek R1', hidePort: true}},
|
|
|
-]
|
|
|
+ {
|
|
|
+ port: { in: 1, out: 1 },
|
|
|
+ style: {},
|
|
|
+ color: "#00b2b2",
|
|
|
+ icon: "icon-wentifenlei",
|
|
|
+ name: "ai-category",
|
|
|
+ component: Custom,
|
|
|
+ data: { name: "问题分类" },
|
|
|
+ },
|
|
|
+ {
|
|
|
+ port: { in: 1, out: 1 },
|
|
|
+ style: {},
|
|
|
+ color: "#00b2b2",
|
|
|
+ icon: "icon-xunhuan1",
|
|
|
+ name: "ai-loop",
|
|
|
+ component: Custom,
|
|
|
+ data: { name: "循环分支" },
|
|
|
+ },
|
|
|
+ {
|
|
|
+ port: { in: 1, out: 1 },
|
|
|
+ style: {},
|
|
|
+ color: "#ff811a",
|
|
|
+ icon: "icon-shiyongwendang",
|
|
|
+ name: "ai-doc",
|
|
|
+ component: Custom,
|
|
|
+ data: { name: "文档提取器" },
|
|
|
+ },
|
|
|
+ {
|
|
|
+ port: { in: 1, out: 1 },
|
|
|
+ style: {},
|
|
|
+ color: "#3071f3",
|
|
|
+ icon: "icon-http",
|
|
|
+ name: "ai-http",
|
|
|
+ component: Custom,
|
|
|
+ data: { name: "HTTP" },
|
|
|
+ },
|
|
|
+ {
|
|
|
+ port: { in: 1, out: 0 },
|
|
|
+ style: { borderTopRightRadius: 36, borderBottomRightRadius: 36 },
|
|
|
+ color: "#d37d1d",
|
|
|
+ icon: "icon-flag",
|
|
|
+ name: "ai-end",
|
|
|
+ component: Custom,
|
|
|
+ data: { name: "结束" },
|
|
|
+ },
|
|
|
+ {
|
|
|
+ port: { in: 0, out: 1 },
|
|
|
+ style: { borderTopLeftRadius: 36, borderBottomLeftRadius: 36 },
|
|
|
+ color: "#5c62ff",
|
|
|
+ icon: "icon-message",
|
|
|
+ name: "ai-start",
|
|
|
+ component: Custom,
|
|
|
+ data: { name: "开始" },
|
|
|
+ },
|
|
|
+ {
|
|
|
+ port: { in: 1, out: 1 },
|
|
|
+ style: {},
|
|
|
+ color: "#00b2b2",
|
|
|
+ icon: "icon-daima",
|
|
|
+ name: "ai-code",
|
|
|
+ component: Custom,
|
|
|
+ data: { name: "代码" },
|
|
|
+ },
|
|
|
+ {
|
|
|
+ port: { in: 1, out: 1 },
|
|
|
+ style: {},
|
|
|
+ color: "#00b2b2",
|
|
|
+ icon: "icon-tiaojianfenzhi",
|
|
|
+ name: "ai-if",
|
|
|
+ component: Custom,
|
|
|
+ data: { name: "条件分支" },
|
|
|
+ },
|
|
|
+ {
|
|
|
+ port: { in: 1, out: 1 },
|
|
|
+ style: {},
|
|
|
+ color: "#00b2b2",
|
|
|
+ icon: "icon-xunhuan",
|
|
|
+ name: "ai-iteration",
|
|
|
+ component: Custom,
|
|
|
+ data: { name: "迭代" },
|
|
|
+ },
|
|
|
+ {
|
|
|
+ port: { in: 1, out: 1 },
|
|
|
+ style: {},
|
|
|
+ color: "#ff811a",
|
|
|
+ icon: "icon-data-update",
|
|
|
+ name: "ai-adddata",
|
|
|
+ component: Custom,
|
|
|
+ data: { name: "数据新增" },
|
|
|
+ },
|
|
|
+ {
|
|
|
+ port: { in: 1, out: 1 },
|
|
|
+ style: {},
|
|
|
+ color: "#ff811a",
|
|
|
+ icon: "icon-data-Inquire",
|
|
|
+ name: "ai-querydata",
|
|
|
+ component: Custom,
|
|
|
+ data: { name: "数据查询" },
|
|
|
+ },
|
|
|
+ {
|
|
|
+ port: { in: 1, out: 1 },
|
|
|
+ style: {},
|
|
|
+ color: "#ff811a",
|
|
|
+ icon: "icon-server-update-full",
|
|
|
+ name: "ai-updatedata",
|
|
|
+ component: Custom,
|
|
|
+ data: { name: "数据更新" },
|
|
|
+ },
|
|
|
+ {
|
|
|
+ port: { in: 1, out: 1 },
|
|
|
+ style: {},
|
|
|
+ color: "#ff811a",
|
|
|
+ icon: "icon-server-update",
|
|
|
+ name: "ai-deldata",
|
|
|
+ component: Custom,
|
|
|
+ data: { name: "数据删除" },
|
|
|
+ },
|
|
|
+ {
|
|
|
+ port: { in: 1, out: 1 },
|
|
|
+ style: {},
|
|
|
+ color: "#ff811a",
|
|
|
+ icon: "icon-book",
|
|
|
+ name: "ai-know",
|
|
|
+ component: Custom,
|
|
|
+ data: { name: "知识检索" },
|
|
|
+ },
|
|
|
+ {
|
|
|
+ port: { in: 1, out: 1 },
|
|
|
+ style: {},
|
|
|
+ color: "#ff811a",
|
|
|
+ icon: "icon-image",
|
|
|
+ name: "ai-ocr",
|
|
|
+ component: Custom,
|
|
|
+ data: { name: "图像识别" },
|
|
|
+ },
|
|
|
+ {
|
|
|
+ port: { in: 1, out: 1 },
|
|
|
+ style: {},
|
|
|
+ color: "#00b2b2",
|
|
|
+ icon: "icon-liebiaoguolvqi",
|
|
|
+ name: "ai-list",
|
|
|
+ component: Custom,
|
|
|
+ data: { name: "列表操作" },
|
|
|
+ },
|
|
|
+ {
|
|
|
+ port: { in: 1, out: 1 },
|
|
|
+ style: {},
|
|
|
+ color: "#ca60fe",
|
|
|
+ icon: "icon-flow",
|
|
|
+ name: "ai-flow",
|
|
|
+ component: Custom,
|
|
|
+ data: { name: "工作流" },
|
|
|
+ },
|
|
|
+ {
|
|
|
+ port: { in: 1, out: 1 },
|
|
|
+ style: {},
|
|
|
+ color: "#00b2b2",
|
|
|
+ icon: "icon-bianliangfuzhi",
|
|
|
+ name: "ai-equal",
|
|
|
+ component: Custom,
|
|
|
+ data: { name: "变量赋值" },
|
|
|
+ },
|
|
|
+ {
|
|
|
+ port: { in: 1, out: 1 },
|
|
|
+ style: {},
|
|
|
+ color: "#1d44d3",
|
|
|
+ icon: "icon-zhinengti-opsasda",
|
|
|
+ name: "ai-llm",
|
|
|
+ component: Custom,
|
|
|
+ data: { name: "逻辑处理模型LLM", type: "model" },
|
|
|
+ width: 256,
|
|
|
+ height: 100,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ port: { in: 1, out: 1 },
|
|
|
+ style: {},
|
|
|
+ color: "#00b2b2",
|
|
|
+ icon: "icon-kaifangAImoxingku",
|
|
|
+ name: "ai-params",
|
|
|
+ component: Custom,
|
|
|
+ data: { name: "参数提取" },
|
|
|
+ },
|
|
|
+ {
|
|
|
+ port: { in: 1, out: 1 },
|
|
|
+ style: {},
|
|
|
+ color: "#00b2b2",
|
|
|
+ icon: "icon-canshutiqu",
|
|
|
+ name: "ai-var",
|
|
|
+ component: Custom,
|
|
|
+ data: { name: "变量聚合" },
|
|
|
+ },
|
|
|
+ {
|
|
|
+ port: { in: 1, out: 1 },
|
|
|
+ style: {},
|
|
|
+ color: "#00b2b2",
|
|
|
+ icon: "icon-chajian1",
|
|
|
+ name: "ai-var",
|
|
|
+ component: Custom,
|
|
|
+ data: { name: "扩展插件", type: "model" },
|
|
|
+ width: 256,
|
|
|
+ height: 100,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ port: { in: 1, out: 1 },
|
|
|
+ style: {},
|
|
|
+ color: "#4d6bfe",
|
|
|
+ icon: "icon-deepseek",
|
|
|
+ name: "ai-model",
|
|
|
+ component: Custom,
|
|
|
+ data: { name: "DeepSeek R1", hidePort: true },
|
|
|
+ },
|
|
|
+];
|
|
|
|
|
|
-aiNode.forEach((node) => {
|
|
|
- register({
|
|
|
- shape: node.name,
|
|
|
- width: node?.width || 100,
|
|
|
- height: node?.height || 100,
|
|
|
- effect: ["data"],
|
|
|
- component: node.component,
|
|
|
- ports: {...ports}
|
|
|
- });
|
|
|
-});
|
|
|
+// aiNode.forEach((node) => {
|
|
|
+// register({
|
|
|
+// shape: node.name,
|
|
|
+// width: node?.width || 100,
|
|
|
+// height: node?.height || 100,
|
|
|
+// effect: ["data"],
|
|
|
+// component: node.component,
|
|
|
+// ports: {...ports}
|
|
|
+// });
|
|
|
+// });
|
|
|
|
|
|
nodes.forEach((node) => {
|
|
|
register({
|
|
|
shape: node.name,
|
|
|
- width: 100,
|
|
|
+ width: ["start-node", "end-node"].includes(node.name) ? 100 : 256,
|
|
|
height: 100,
|
|
|
effect: ["data"],
|
|
|
+ data: {
|
|
|
+ ...(node.data || {}),
|
|
|
+ type: node.type,
|
|
|
+ },
|
|
|
component: node.component,
|
|
|
- ports: {...ports}
|
|
|
+ ports: { ...ports },
|
|
|
});
|
|
|
});
|
|
|
|
|
|
register({
|
|
|
- shape: 'menu-popover',
|
|
|
+ shape: "menu-popover",
|
|
|
width: 304,
|
|
|
height: 184,
|
|
|
- component: PopoverNode
|
|
|
-});
|
|
|
+ component: PopoverNode,
|
|
|
+});
|