/* package com.ruoyi; import com.agentsflex.core.chain.Chain; import com.agentsflex.core.chain.ChainEvent; import com.agentsflex.core.chain.ChainNode; import com.agentsflex.core.chain.event.ChainStartEvent; import com.agentsflex.core.chain.event.ChainStatusChangeEvent; import com.agentsflex.core.chain.event.NodeEndEvent; import com.agentsflex.core.chain.event.NodeStartEvent; import com.agentsflex.core.chain.listener.ChainEventListener; import com.agentsflex.core.chain.listener.ChainOutputListener; import com.agentsflex.llm.openai.OpenAILlm; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.github.yulichang.wrapper.MPJLambdaWrapper; import com.ruoyi.interfaces.tinyflow.parser.PrintNodeParser; import com.ruoyi.interfaces.tinyflow.parser.ServiceNodeParser; import com.ruoyi.model.dpp.dal.dataobject.etl.DppEtlTaskDO; import com.ruoyi.model.etl.mapper.DppEtlTaskMapper; import dev.tinyflow.core.Tinyflow; import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import javax.annotation.Resource; import java.util.HashMap; import java.util.Map; public class TinyflowTest { // static String data1 = ""; //static String data1 = "{\"nodes\":[{\"id\":\"2\",\"type\":\"llmNode\",\"data\":{\"title\":\"大模型\",\"description\":\"处理大模型相关问题\",\"expand\":true,\"outputDefs\":[{\"id\":\"pyiig8ntGWZhVdVz\",\"dataType\":\"Object\",\"name\":\"param\",\"children\":[{\"id\":\"1\",\"name\":\"newParam1\",\"dataType\":\"String\"},{\"id\":\"2\",\"name\":\"newParam2\",\"dataType\":\"String\"}]}]},\"position\":{\"x\":600,\"y\":50},\"measured\":{\"width\":334,\"height\":687},\"selected\":false},{\"id\":\"3\",\"type\":\"startNode\",\"data\":{\"title\":\"开始节点\",\"description\":\"开始定义输入参数\",\"expand\":true,\"parameters\":[{\"id\":\"Q37GZ5KKvPpCD7Cs\",\"name\":\"name\"}]},\"position\":{\"x\":150,\"y\":25},\"measured\":{\"width\":306,\"height\":209},\"selected\":false},{\"id\":\"4\",\"type\":\"endNode\",\"data\":{\"title\":\"结束节点\",\"description\":\"结束定义输出参数\",\"expand\":true,\"outputDefs\":[{\"id\":\"z7fOwoTjQ7AbUJdm\",\"ref\":\"3.name\",\"name\":\"test\"}]},\"position\":{\"x\":994,\"y\":218},\"measured\":{\"width\":334,\"height\":209},\"selected\":false,\"dragging\":false}],\"edges\":[{\"markerEnd\":{\"type\":\"arrowclosed\",\"width\":20,\"height\":20},\"source\":\"3\",\"target\":\"2\",\"id\":\"xy-edge__3-2\"},{\"markerEnd\":{\"type\":\"arrowclosed\",\"width\":20,\"height\":20},\"source\":\"2\",\"target\":\"4\",\"id\":\"xy-edge__2-4\"}],\"viewport\":{\"x\":250,\"y\":100,\"zoom\":1}}"; static String data1 = "{\n" + " \"nodes\": [\n" + " {\n" + " \"id\": \"1\",\n" + " \"type\": \"startNode\",\n" + " \"data\": {\n" + " \"title\": \"开始节点\",\n" + " \"description\": \"开始定义输入参数\",\n" + " \"expand\": true,\n" + " \"parameters\": [\n" + " {\n" + " \"name\": \"year\",\n" + " \"dataType\": \"String\",\n" + " \"refType\": \"input\",\n" + " \"required\": true,\n" + " \"description\": \"第一个输入参数\"\n" + " },\n" + " {\n" + " \"name\": \"inputParam2\",\n" + " \"dataType\": \"Number\",\n" + " \"refType\": \"input\",\n" + " \"required\": false,\n" + " \"description\": \"第二个输入参数\",\n" + " \"defaultValue\": 100\n" + " }\n" + " ]\n" + " },\n" + " \"position\": {\n" + " \"x\": 150,\n" + " \"y\": 25\n" + " },\n" + " \"measured\": {\n" + " \"width\": 306,\n" + " \"height\": 209\n" + " },\n" + " \"selected\": false\n" + " },\n" + " {\n" + " \"id\": \"2\",\n" + " \"data\": {\n" + " \"title\": \"服务节点\",\n" + " \"parameters\": [\n" + " {\n" + " \"name\": \"year\",\n" + " \"dataType\": \"String\",\n" + " \"ref\": \"1.year\",\n" + " \"refType\": \"ref\"\n" + " }\n" + " ],\n" + " \"service\": {\n" + " \"srvId\": \"634ae1e0ee78e00bd609b85514961373\",\n" + " \"mdid\": \"e4dc50dd-c4a9-4639-b43e-62e48314a7e0\",\n" + " \"cateCode\": \"S\",\n" + " \"name\": \"获取台风信息列表\",\n" + " \"intro\": \"获取有台风的编号及名称\",\n" + " \"serviceSource\": null,\n" + " \"serviceDept\": null,\n" + " \"manageName\": null,\n" + " \"developUnit\": null,\n" + " \"developContacter\": null,\n" + " \"maintainUnit\": null,\n" + " \"maintainContacer\": null,\n" + " \"upCycl\": null,\n" + " \"openCndtn\": null,\n" + " \"adName\": null,\n" + " \"dataField\": null,\n" + " \"dataRange\": null,\n" + " \"userId\": null,\n" + " \"status\": null,\n" + " \"note\": null,\n" + " \"type\": \"HTTP\",\n" + " \"url\": \"http://49.4.2.185:2111/RiverStrongAPI2.0/StormSurgeForecast/Typhoon/GetInfos\",\n" + " \"rqtype\": \"POST\",\n" + " \"rptype\": \"1\",\n" + " \"rpcontent\": \"{\\n \\\"data\\\": [\\n {\\n \\\"typhoonId\\\": \\\"202317\\\",\\n \\\"typhoonName\\\": \\\"杰拉华\\\",\\n \\\"test\\\": \\\"1123\\\"\\n },\\n {\\n \\\"typhoonId\\\": \\\"202316\\\",\\n \\\"typhoonName\\\": \\\"三巴\\\",\\n \\\"test\\\": \\\"1123\\\"\\n \\n }\\n ],\\n \\\"succeeded\\\": true,\\n \\\"statusCode\\\": 200,\\n \\\"remark\\\": \\\"获取该年台风信息成功\\\"\\n}\",\n" + " \"proxyAddress\": null,\n" + " \"proxyPath\": null,\n" + " \"example\": \"\",\n" + " \"cnt\": null,\n" + " \"viewNum\": 0,\n" + " \"applyNum\": null,\n" + " \"dataNum\": null,\n" + " \"tm\": null,\n" + " \"uptm\": null,\n" + " \"rlstm\": null,\n" + " \"releaseTime\": null,\n" + " \"attentionId\": null,\n" + " \"params\": [\n" + " {\n" + " \"srvId\": \"634ae1e0ee78e00bd609b85514961373\",\n" + " \"paramCode\": \"year\",\n" + " \"paramName\": \"年份\",\n" + " \"paramType\": \"int\",\n" + " \"paramValue\": \"2023\",\n" + " \"paramFormat\": null,\n" + " \"paramNote\": \"\",\n" + " \"sort\": 0,\n" + " \"paramObject\": 2023\n" + " }\n" + " ],\n" + " \"sort\": null,\n" + " \"audit\": null\n" + " }\n" + " },\n" + " \"type\": \"serviceNode\",\n" + " \"position\": {\n" + " \"x\": 600,\n" + " \"y\": 50\n" + " },\n" + " \"measured\": {\n" + " \"width\": 334,\n" + " \"height\": 687\n" + " },\n" + " \"selected\": false\n" + " },\n" + " {\n" + " \"id\": \"3\",\n" + " \"type\": \"endNode\",\n" + " \"data\": {\n" + " \"title\": \"结束节点\",\n" + " \"description\": \"结束定义输出参数\",\n" + " \"expand\": true,\n" + " \"outputDefs\": [\n" + " {\n" + " \"name\": \"data\",\n" + " \"dataType\": \"Object\",\n" + " \"ref\": \"2.result\",\n" + " \"refType\": \"ref\"\n" + " }\n" + " ]\n" + " },\n" + " \"position\": {\n" + " \"x\": 994,\n" + " \"y\": 218\n" + " },\n" + " \"measured\": {\n" + " \"width\": 334,\n" + " \"height\": 209\n" + " },\n" + " \"selected\": false,\n" + " \"dragging\": false\n" + " }\n" + " ],\n" + " \"edges\": [\n" + " {\n" + " \"markerEnd\": {\n" + " \"type\": \"arrowclosed\",\n" + " \"width\": 20,\n" + " \"height\": 20\n" + " },\n" + " \"source\": \"1\",\n" + " \"target\": \"2\",\n" + " \"id\": \"xy-edge__1-2\"\n" + " },\n" + " {\n" + " \"markerEnd\": {\n" + " \"type\": \"arrowclosed\",\n" + " \"width\": 20,\n" + " \"height\": 20\n" + " },\n" + " \"source\": \"2\",\n" + " \"target\": \"3\",\n" + " \"id\": \"xy-edge__2-3\"\n" + " }\n" + " ],\n" + " \"viewport\": {\n" + " \"x\": 250,\n" + " \"y\": 100,\n" + " \"zoom\": 1\n" + " }\n" + "}"; public static void main(String[] args) { */ /*System.out.println(data1); Tinyflow tinyflow = new Tinyflow(data1); tinyflow.getChainParser().addNodeParser("printNode",new PrintNodeParser()); tinyflow.getChainParser().addNodeParser("serviceNode",new ServiceNodeParser()); // tinyflow.setLlmProvider(id -> OpenAILlm.of("")); Map variables = new HashMap<>(); variables.put("year", "2024"); variables.put("inputParam2", 2); Chain chain = tinyflow.toChain(); chain.addEventListener(new ChainEventListener() { @Override public void onEvent(ChainEvent event, Chain chain) { if (event instanceof ChainStartEvent) { } if (event instanceof ChainStatusChangeEvent) { } if (event instanceof NodeStartEvent) { } if (event instanceof NodeEndEvent) { } } }); chain.addOutputListener(new ChainOutputListener() { @Override public void onOutput(Chain chain, ChainNode node, Object outputMessage) { System.out.println("outputMessage: " + outputMessage); } }); Map result = chain.executeForResult(variables); System.out.println("result:" + result);*//* // TestService testService = new TestService(); // System.out.println(testService.helloTest()); } @Resource private DppEtlTaskMapper dppEtlTaskMapper ; @Test public void testSelectJoinPage() { MPJLambdaWrapper wrapper = new MPJLambdaWrapper<>(); // 添加简单的查询条件 wrapper.eq(DppEtlTaskDO::getDelFlag, "0"); try { IPage result = dppEtlTaskMapper.selectJoinPage( new Page<>(1, 10), DppEtlTaskDO.class, wrapper ); System.out.println("查询成功,结果数量:" + result.getRecords().size()); } catch (Exception e) { System.out.println("查询失败:" + e.getMessage()); e.printStackTrace(); } } } */