Add File
This commit is contained in:
@@ -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<String>\",\"name\":\"A\",\"id\":\"tD6lUMu5GBZUBabP\"}]}],\"dataType\":\"Array<Object>\",\"name\":\"testC\",\"id\":\"OGWXJptVKxiCm39F\"}],\"dataType\":\"Object\",\"name\":\"conditionType\",\"id\":\"YZaNLVB1CVnXoQAt\"}],\"dataType\":\"Array\",\"name\":\"couponList\",\"refType\":\"ref\",\"id\":\"oVp2EN2GhnYOInHM\"}]";
|
||||
List<Parameter> 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)));
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user