diff --git a/agents-flex-core/src/test/java/com/agentsflex/core/test/chain/LlmNodeTest.java b/agents-flex-core/src/test/java/com/agentsflex/core/test/chain/LlmNodeTest.java new file mode 100644 index 0000000..5d504c3 --- /dev/null +++ b/agents-flex-core/src/test/java/com/agentsflex/core/test/chain/LlmNodeTest.java @@ -0,0 +1,22 @@ +package com.agentsflex.core.test.chain; + +import com.agentsflex.core.chain.Parameter; +import com.agentsflex.core.chain.node.LlmNode; +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONArray; +import com.alibaba.fastjson.JSONObject; +import org.junit.Test; +import java.util.List; + +public class LlmNodeTest { + + @Test + public void testLlmJson() { + String outputDefsJson = "[{\"children\":[{\"dataType\":\"Number\",\"name\":\"doorsill\",\"id\":\"Ma9ODQN2YAjjcho1\"},{\"dataType\":\"Number\",\"name\":\"decrease\",\"id\":\"WeGXIgsmC4xR5iLf\"},{\"dataType\":\"String\",\"name\":\"startTime\",\"id\":\"Iml4HFnZj3Msv7Ik\"},{\"children\":[{\"dataType\":\"String\",\"name\":\"testA\",\"id\":\"23eYb9FwXcnhA9I5\"},{\"dataType\":\"String\",\"name\":\"testB\",\"id\":\"FFgwuCULez7r3GOX\"},{\"children\":[{\"dataType\":\"Array\",\"name\":\"newParam\",\"id\":\"tD6lUMu5GBZUBabP\",\"children\":[{\"dataType\":\"Array\",\"name\":\"A\",\"id\":\"tD6lUMu5GBZUBabP\"}]}],\"dataType\":\"Array\",\"name\":\"testC\",\"id\":\"OGWXJptVKxiCm39F\"}],\"dataType\":\"Object\",\"name\":\"conditionType\",\"id\":\"YZaNLVB1CVnXoQAt\"}],\"dataType\":\"Array\",\"name\":\"couponList\",\"refType\":\"ref\",\"id\":\"oVp2EN2GhnYOInHM\"}]"; + List outputDefs = JSONArray.parseArray(outputDefsJson, Parameter.class); + String content = "{\"couponList\":[{\"startTime\":\"2025-05-09 00:00:00\",\"conditionType\":{\"testB\":\"BBB\",\"testC\":[{\"newParam\":{\"A\":[\"10001\",10002]}}],\"testA\":\"AAAA\"},\"doorsill\":648,\"decrease\":648}]}"; + JSONObject data = JSON.parseObject(content); + System.out.println(JSON.toJSON(LlmNode.getExecuteResultMap(outputDefs, data))); + } + +}