feat: 整体项目架构完成, 运行的核心算法完成, 自定义节点starter以外定义节点测试通过
This commit is contained in:
@@ -0,0 +1,10 @@
|
||||
package com.metisapp.custom;
|
||||
|
||||
import com.metis.domain.entity.base.NodeConfig;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class CustomTestConfig extends NodeConfig {
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package com.metisapp.custom;
|
||||
|
||||
import com.metis.domain.context.RunningContext;
|
||||
import com.metis.domain.context.RunningResult;
|
||||
import com.metis.domain.entity.base.Edge;
|
||||
import com.metis.domain.entity.base.Node;
|
||||
import com.metis.runner.CustomNodeRunner;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Slf4j
|
||||
@Service
|
||||
public class CustomTestRunner implements CustomNodeRunner<CustomTestConfig> {
|
||||
|
||||
@Override
|
||||
public String getCustomNodeType() {
|
||||
return "test";
|
||||
}
|
||||
|
||||
@Override
|
||||
public RunningResult run(RunningContext context, Node node, List<Edge> edges) {
|
||||
log.info("自定义节点测试");
|
||||
return RunningResult.buildResult();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
package com.metisapp.custom;
|
||||
|
||||
import com.metis.domain.entity.base.Edge;
|
||||
import com.metis.domain.entity.base.Node;
|
||||
import com.metis.validator.CustomNodeValidator;
|
||||
import com.metis.validator.ValidatorResult;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Slf4j
|
||||
@Service
|
||||
public class CustomTestValidator implements CustomNodeValidator<CustomTestConfig> {
|
||||
|
||||
@Override
|
||||
public String getCustomNodeType() {
|
||||
return "test";
|
||||
}
|
||||
|
||||
@Override
|
||||
public ValidatorResult validateValue(Node node) {
|
||||
CustomTestConfig config = node.getConfig();
|
||||
return ValidatorResult.valid();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ValidatorResult validateRelation(Node node, List<Edge> sources, List<Edge> targets) {
|
||||
CustomTestConfig config = node.getConfig();
|
||||
return ValidatorResult.valid();
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
{
|
||||
"id": 0,
|
||||
"name": "测试流程",
|
||||
@@ -8,145 +7,561 @@
|
||||
{
|
||||
"id": "5",
|
||||
"type": "start",
|
||||
"dimensions": {
|
||||
"width": 300,
|
||||
"height": 300
|
||||
"initialized": false,
|
||||
"position": {
|
||||
"x": -81.81250000000003,
|
||||
"y": 275.49609375
|
||||
},
|
||||
"draggable": true,
|
||||
"resizing": false,
|
||||
"selected": true,
|
||||
"data": {
|
||||
"label": "开始",
|
||||
"icon": "SuitcaseLine",
|
||||
"toolbarPosition": "right",
|
||||
"description": "开始述描述",
|
||||
"config": {
|
||||
"variables": [
|
||||
{
|
||||
"variable": "context",
|
||||
"label": "段落",
|
||||
"type": "paragraph",
|
||||
"maxLength": 48,
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"variable": "text",
|
||||
"label": "文本",
|
||||
"type": "text-input",
|
||||
"maxLength": 48,
|
||||
"required": true,
|
||||
"options": []
|
||||
},
|
||||
{
|
||||
"variable": "select",
|
||||
"label": "下拉",
|
||||
"type": "select",
|
||||
"maxLength": 48,
|
||||
"required": true,
|
||||
"options": [
|
||||
{
|
||||
"label": "选型1",
|
||||
"value": "1"
|
||||
},
|
||||
{
|
||||
"label": "选型2",
|
||||
"value": "2"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"variable": "number",
|
||||
"label": "数字",
|
||||
"type": "number",
|
||||
"maxLength": 48,
|
||||
"required": true,
|
||||
"options": []
|
||||
},
|
||||
{
|
||||
"variable": "singlefile",
|
||||
"label": "singlefile单文件",
|
||||
"type": "file",
|
||||
"maxLength": 48,
|
||||
"required": true,
|
||||
"options": [],
|
||||
"allowedFileUploadMethods": [
|
||||
"local_file",
|
||||
"remote_url"
|
||||
],
|
||||
"allowedFileTypes": [
|
||||
"image",
|
||||
"document",
|
||||
"audio",
|
||||
"video"
|
||||
],
|
||||
"allowedFileExtensions": []
|
||||
},
|
||||
{
|
||||
"variable": "mufile",
|
||||
"label": "多文件",
|
||||
"type": "file-list",
|
||||
"maxLength": 5,
|
||||
"required": true,
|
||||
"options": [],
|
||||
"allowedFileUploadMethods": [
|
||||
"local_file"
|
||||
],
|
||||
"allowedFileTypes": [
|
||||
"custom"
|
||||
],
|
||||
"allowedFileExtensions": [
|
||||
"docx",
|
||||
"aaa"
|
||||
]
|
||||
}
|
||||
],
|
||||
"parent": "234"
|
||||
},
|
||||
"handles": [
|
||||
{
|
||||
"id": "7",
|
||||
"id": "51",
|
||||
"position": "right",
|
||||
"type": "source",
|
||||
"connectable": true
|
||||
}
|
||||
]
|
||||
],
|
||||
"item": {
|
||||
"id": "2",
|
||||
"type": "run",
|
||||
"labelType": "knowledge",
|
||||
"label": "知识检索"
|
||||
}
|
||||
},
|
||||
"position": { "x": 0, "y": 300 }
|
||||
"width": 200,
|
||||
"height": 40
|
||||
},
|
||||
{
|
||||
"id": "6",
|
||||
"type": "end",
|
||||
"selected": false,
|
||||
"initialized": false,
|
||||
"position": {
|
||||
"x": 1281.582055572882,
|
||||
"y": 236.2912067630247
|
||||
},
|
||||
"data": {
|
||||
"label": "结束",
|
||||
"toolbarPosition": "right",
|
||||
"handles": [
|
||||
{
|
||||
"id": "8",
|
||||
"id": "61",
|
||||
"position": "left",
|
||||
"type": "target",
|
||||
"connectable": true
|
||||
}
|
||||
]
|
||||
},
|
||||
"position": { "x": 500, "y": 300 }
|
||||
"width": 200,
|
||||
"height": 40
|
||||
},
|
||||
{
|
||||
"id": "188",
|
||||
"type": "custom",
|
||||
"customType": "test",
|
||||
"initialized": false,
|
||||
"position": {
|
||||
"x": 265.87532955148635,
|
||||
"y": 71.40983063296031
|
||||
},
|
||||
"data": {
|
||||
"label": "llm1",
|
||||
"icon": "",
|
||||
"description": "llm描述描述",
|
||||
"toolbarPosition": "right",
|
||||
"config": {
|
||||
"labelType": "llm"
|
||||
},
|
||||
"handles": [
|
||||
{
|
||||
"id": "11",
|
||||
"position": "left",
|
||||
"type": "source",
|
||||
"connectable": true
|
||||
},
|
||||
{
|
||||
"id": "45",
|
||||
"position": "right",
|
||||
"type": "source",
|
||||
"connectable": true
|
||||
}
|
||||
]
|
||||
},
|
||||
"width": 200,
|
||||
"height": null
|
||||
},
|
||||
{
|
||||
"id": "850",
|
||||
"type": "llm",
|
||||
"initialized": false,
|
||||
"position": {
|
||||
"x": 269.7896091295129,
|
||||
"y": 253.80570624004747
|
||||
},
|
||||
"data": {
|
||||
"label": "llm2",
|
||||
"icon": "",
|
||||
"description": "llm描述描述",
|
||||
"toolbarPosition": "right",
|
||||
"config": {
|
||||
"labelType": "llm"
|
||||
},
|
||||
"handles": [
|
||||
{
|
||||
"id": "43",
|
||||
"position": "left",
|
||||
"type": "source",
|
||||
"connectable": true
|
||||
},
|
||||
{
|
||||
"id": "57",
|
||||
"position": "right",
|
||||
"type": "source",
|
||||
"connectable": true
|
||||
}
|
||||
]
|
||||
},
|
||||
"width": 200,
|
||||
"height": null
|
||||
},
|
||||
{
|
||||
"id": "979",
|
||||
"type": "llm",
|
||||
"initialized": false,
|
||||
"position": {
|
||||
"x": 257.0893454883237,
|
||||
"y": 360
|
||||
},
|
||||
"data": {
|
||||
"label": "llm3",
|
||||
"icon": "",
|
||||
"description": "llm描述描述",
|
||||
"toolbarPosition": "right",
|
||||
"config": {
|
||||
"labelType": "llm"
|
||||
},
|
||||
"handles": [
|
||||
{
|
||||
"id": "40",
|
||||
"position": "left",
|
||||
"type": "source",
|
||||
"connectable": true
|
||||
},
|
||||
{
|
||||
"id": "46",
|
||||
"position": "right",
|
||||
"type": "source",
|
||||
"connectable": true
|
||||
}
|
||||
],
|
||||
"item": {
|
||||
"id": "1",
|
||||
"type": "run",
|
||||
"labelType": "llm",
|
||||
"label": "llm"
|
||||
}
|
||||
},
|
||||
"width": 200,
|
||||
"height": null
|
||||
},
|
||||
{
|
||||
"id": "818",
|
||||
"type": "questionClassifier",
|
||||
"initialized": false,
|
||||
"position": {
|
||||
"x": 247.56414775743187,
|
||||
"y": 467.44099824508874
|
||||
},
|
||||
"data": {
|
||||
"label": "知识检索条件",
|
||||
"icon": "",
|
||||
"description": "知识检索描述描述",
|
||||
"toolbarPosition": "right",
|
||||
"config": {
|
||||
"labelType": "knowledge"
|
||||
},
|
||||
"handles": [
|
||||
{
|
||||
"id": "86",
|
||||
"position": "left",
|
||||
"type": "source",
|
||||
"connectable": true
|
||||
},
|
||||
{
|
||||
"id": "11",
|
||||
"position": "right",
|
||||
"type": "source",
|
||||
"connectable": true
|
||||
}
|
||||
],
|
||||
"item": {
|
||||
"id": "1",
|
||||
"type": "run",
|
||||
"labelType": "llm",
|
||||
"label": "llm"
|
||||
}
|
||||
},
|
||||
"width": 200,
|
||||
"height": null
|
||||
},
|
||||
{
|
||||
"id": "288",
|
||||
"type": "llm",
|
||||
"initialized": false,
|
||||
"position": {
|
||||
"x": 545.6891477574318,
|
||||
"y": 431.4042601585389
|
||||
},
|
||||
"data": {
|
||||
"label": "llm5",
|
||||
"icon": "",
|
||||
"description": "llm描述描述",
|
||||
"toolbarPosition": "right",
|
||||
"config": {
|
||||
"labelType": "llm"
|
||||
},
|
||||
"handles": [
|
||||
{
|
||||
"id": "27",
|
||||
"position": "left",
|
||||
"type": "source",
|
||||
"connectable": true
|
||||
},
|
||||
{
|
||||
"id": "90",
|
||||
"position": "right",
|
||||
"type": "source",
|
||||
"connectable": true
|
||||
}
|
||||
]
|
||||
},
|
||||
"width": 200,
|
||||
"height": null
|
||||
},
|
||||
{
|
||||
"id": "873",
|
||||
"type": "llm",
|
||||
"initialized": false,
|
||||
"position": {
|
||||
"x": 561.0654659633774,
|
||||
"y": 547.6673703535477
|
||||
},
|
||||
"data": {
|
||||
"label": "llm6",
|
||||
"icon": "",
|
||||
"description": "llm描述描述",
|
||||
"toolbarPosition": "right",
|
||||
"config": {
|
||||
"labelType": "llm"
|
||||
},
|
||||
"handles": [
|
||||
{
|
||||
"id": "31",
|
||||
"position": "left",
|
||||
"type": "source",
|
||||
"connectable": true
|
||||
},
|
||||
{
|
||||
"id": "51",
|
||||
"position": "right",
|
||||
"type": "source",
|
||||
"connectable": true
|
||||
}
|
||||
]
|
||||
},
|
||||
"width": 200,
|
||||
"height": null
|
||||
},
|
||||
{
|
||||
"id": "244",
|
||||
"type": "llm",
|
||||
"initialized": false,
|
||||
"position": {
|
||||
"x": 543.1540601095024,
|
||||
"y": 653.309197614774
|
||||
},
|
||||
"data": {
|
||||
"label": "llm7",
|
||||
"icon": "",
|
||||
"description": "llm描述描述",
|
||||
"toolbarPosition": "right",
|
||||
"config": {
|
||||
"labelType": "llm"
|
||||
},
|
||||
"handles": [
|
||||
{
|
||||
"id": "33",
|
||||
"position": "left",
|
||||
"type": "source",
|
||||
"connectable": true
|
||||
},
|
||||
{
|
||||
"id": "13",
|
||||
"position": "right",
|
||||
"type": "source",
|
||||
"connectable": true
|
||||
}
|
||||
]
|
||||
},
|
||||
"width": 200,
|
||||
"height": null
|
||||
},
|
||||
{
|
||||
"id": "308",
|
||||
"type": "llm",
|
||||
"initialized": false,
|
||||
"position": {
|
||||
"x": 588.7086470279171,
|
||||
"y": 318.8609378786052
|
||||
},
|
||||
"data": {
|
||||
"label": "llm4",
|
||||
"icon": "",
|
||||
"description": "llm描述描述",
|
||||
"toolbarPosition": "right",
|
||||
"config": {
|
||||
"labelType": "llm"
|
||||
},
|
||||
"handles": [
|
||||
{
|
||||
"id": "17",
|
||||
"position": "left",
|
||||
"type": "source",
|
||||
"connectable": true
|
||||
},
|
||||
{
|
||||
"id": "73",
|
||||
"position": "right",
|
||||
"type": "source",
|
||||
"connectable": true
|
||||
}
|
||||
]
|
||||
},
|
||||
"width": 200,
|
||||
"height": null
|
||||
}
|
||||
],
|
||||
"edges": [
|
||||
{
|
||||
"id": "6",
|
||||
"id": "188",
|
||||
"type": "default",
|
||||
"source": "5",
|
||||
"target": "6",
|
||||
"sourceHandle": "7",
|
||||
"target": "188",
|
||||
"sourceHandle": "51",
|
||||
"targetHandle": "11",
|
||||
"data": {},
|
||||
"label": "",
|
||||
"animated": true,
|
||||
"targetHandle": "8",
|
||||
"label": "线标签",
|
||||
"markerEnd": "none",
|
||||
"markerStart": "none",
|
||||
"updatable": true,
|
||||
"selectable": true,
|
||||
"deletable": true
|
||||
"sourceX": 124.52083333333331,
|
||||
"sourceY": 295.3294270833333,
|
||||
"targetX": 262.70866773530213,
|
||||
"targetY": 98.2431395846395
|
||||
},
|
||||
{
|
||||
"id": "vueflow__edge-18845-661",
|
||||
"type": "default",
|
||||
"source": "188",
|
||||
"target": "6",
|
||||
"sourceHandle": "45",
|
||||
"targetHandle": "61",
|
||||
"data": {},
|
||||
"label": "",
|
||||
"sourceX": 472.20841119628,
|
||||
"sourceY": 98.2431395846395,
|
||||
"targetX": 1278.4153889062152,
|
||||
"targetY": 256.12454009635803
|
||||
},
|
||||
{
|
||||
"id": "850",
|
||||
"type": "default",
|
||||
"source": "5",
|
||||
"target": "850",
|
||||
"sourceHandle": "51",
|
||||
"targetHandle": "43",
|
||||
"data": {},
|
||||
"label": "",
|
||||
"animated": true,
|
||||
"sourceX": 124.52083333333331,
|
||||
"sourceY": 295.3294270833333,
|
||||
"targetX": 266.62293379655364,
|
||||
"targetY": 280.6389855757115
|
||||
},
|
||||
{
|
||||
"id": "vueflow__edge-85057-661",
|
||||
"type": "default",
|
||||
"source": "850",
|
||||
"target": "6",
|
||||
"sourceHandle": "57",
|
||||
"targetHandle": "61",
|
||||
"data": {},
|
||||
"label": "",
|
||||
"sourceX": 476.1223496202179,
|
||||
"sourceY": 280.6389855757115,
|
||||
"targetX": 1278.4153889062152,
|
||||
"targetY": 256.12454009635803
|
||||
},
|
||||
{
|
||||
"id": "979",
|
||||
"type": "default",
|
||||
"source": "5",
|
||||
"target": "979",
|
||||
"sourceHandle": "51",
|
||||
"targetHandle": "40",
|
||||
"data": {},
|
||||
"label": "",
|
||||
"animated": true,
|
||||
"sourceX": 124.52083333333331,
|
||||
"sourceY": 295.3294270833333,
|
||||
"targetX": 253.92267015536444,
|
||||
"targetY": 386.83332778318527
|
||||
},
|
||||
{
|
||||
"id": "818",
|
||||
"type": "default",
|
||||
"source": "5",
|
||||
"target": "818",
|
||||
"sourceHandle": "51",
|
||||
"targetHandle": "86",
|
||||
"data": {},
|
||||
"label": "",
|
||||
"animated": true,
|
||||
"sourceX": 124.52083333333331,
|
||||
"sourceY": 295.3294270833333,
|
||||
"targetX": 244.3974724244726,
|
||||
"targetY": 494.2742291332315
|
||||
},
|
||||
{
|
||||
"id": "288",
|
||||
"type": "default",
|
||||
"source": "818",
|
||||
"target": "288",
|
||||
"sourceHandle": "11",
|
||||
"targetHandle": "27",
|
||||
"data": {},
|
||||
"label": "",
|
||||
"animated": true,
|
||||
"sourceX": 453.89688824813686,
|
||||
"sourceY": 494.2742291332315,
|
||||
"targetX": 542.5224239769512,
|
||||
"targetY": 458.2374910466816
|
||||
},
|
||||
{
|
||||
"id": "873",
|
||||
"type": "default",
|
||||
"source": "818",
|
||||
"target": "873",
|
||||
"sourceHandle": "11",
|
||||
"targetHandle": "31",
|
||||
"data": {},
|
||||
"label": "",
|
||||
"animated": true,
|
||||
"sourceX": 453.89688824813686,
|
||||
"sourceY": 494.2742291332315,
|
||||
"targetX": 557.8988921284383,
|
||||
"targetY": 574.5006486940537
|
||||
},
|
||||
{
|
||||
"id": "244",
|
||||
"type": "default",
|
||||
"source": "818",
|
||||
"target": "244",
|
||||
"sourceHandle": "11",
|
||||
"targetHandle": "33",
|
||||
"data": {},
|
||||
"label": "",
|
||||
"animated": true,
|
||||
"sourceX": 453.89688824813686,
|
||||
"sourceY": 494.2742291332315,
|
||||
"targetX": 539.9875200651626,
|
||||
"targetY": 680.1424930622838
|
||||
},
|
||||
{
|
||||
"id": "vueflow__edge-28890-661",
|
||||
"type": "default",
|
||||
"source": "288",
|
||||
"target": "6",
|
||||
"sourceHandle": "90",
|
||||
"targetHandle": "61",
|
||||
"data": {},
|
||||
"label": "",
|
||||
"sourceX": 752.0218882481367,
|
||||
"sourceY": 458.2374910466816,
|
||||
"targetX": 1278.4153889062152,
|
||||
"targetY": 256.12454009635803
|
||||
},
|
||||
{
|
||||
"id": "vueflow__edge-87351-661",
|
||||
"type": "default",
|
||||
"source": "873",
|
||||
"target": "6",
|
||||
"sourceHandle": "51",
|
||||
"targetHandle": "61",
|
||||
"data": {},
|
||||
"label": "",
|
||||
"sourceX": 767.3988903613488,
|
||||
"sourceY": 574.5006486940537,
|
||||
"targetX": 1278.4153889062152,
|
||||
"targetY": 256.12454009635803
|
||||
},
|
||||
{
|
||||
"id": "vueflow__edge-24413-661",
|
||||
"type": "default",
|
||||
"source": "244",
|
||||
"target": "6",
|
||||
"sourceHandle": "13",
|
||||
"targetHandle": "61",
|
||||
"data": {},
|
||||
"label": "",
|
||||
"sourceX": 749.4874144445799,
|
||||
"sourceY": 680.1424930622838,
|
||||
"targetX": 1278.4153889062152,
|
||||
"targetY": 256.12454009635803
|
||||
},
|
||||
{
|
||||
"id": "308",
|
||||
"type": "default",
|
||||
"source": "979",
|
||||
"target": "308",
|
||||
"sourceHandle": "46",
|
||||
"targetHandle": "17",
|
||||
"data": {},
|
||||
"label": "",
|
||||
"animated": true,
|
||||
"sourceX": 463.42208597902874,
|
||||
"sourceY": 386.83332778318527,
|
||||
"targetX": 585.5419963013785,
|
||||
"targetY": 345.6941732530918
|
||||
},
|
||||
{
|
||||
"id": "vueflow__edge-30873-661",
|
||||
"type": "default",
|
||||
"source": "308",
|
||||
"target": "6",
|
||||
"sourceHandle": "73",
|
||||
"targetHandle": "61",
|
||||
"data": {},
|
||||
"label": "",
|
||||
"sourceX": 795.0417833691082,
|
||||
"sourceY": 345.6941732530918,
|
||||
"targetX": 1278.4153889062152,
|
||||
"targetY": 256.12454009635803
|
||||
}
|
||||
]
|
||||
],
|
||||
"position": [
|
||||
447.2060780237498,
|
||||
377.80084997067763
|
||||
],
|
||||
"zoom": 0.8311688311688327,
|
||||
"viewport": {
|
||||
"x": 447.2060780237498,
|
||||
"y": 377.80084997067763,
|
||||
"zoom": 0.8311688311688327
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user