测试并行

This commit is contained in:
2025-03-02 23:48:46 +08:00
parent 5d888f648a
commit 1da380ace3
4 changed files with 38 additions and 0 deletions

View File

@@ -1,5 +1,8 @@
package com.lanyuanxiaoyao.ai.analysis;
import com.yomahub.liteflow.core.FlowExecutor;
import com.yomahub.liteflow.flow.LiteflowResponse;
import jakarta.annotation.Resource;
import java.net.http.HttpClient;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.ApplicationArguments;
@@ -18,8 +21,13 @@ public class AnalysisApplication implements ApplicationRunner {
SpringApplication.run(AnalysisApplication.class, args);
}
@Resource
private FlowExecutor flowExecutor;
@Override
public void run(ApplicationArguments args) {
LiteflowResponse response = flowExecutor.execute2Resp("chain_1");
log.info(String.valueOf(response.isSuccess()));
}
@Bean

View File

@@ -0,0 +1,21 @@
package com.lanyuanxiaoyao.ai.analysis.flow;
import com.yomahub.liteflow.annotation.LiteflowComponent;
import com.yomahub.liteflow.annotation.LiteflowMethod;
import com.yomahub.liteflow.core.NodeComponent;
import com.yomahub.liteflow.enums.LiteFlowMethodEnum;
import lombok.extern.slf4j.Slf4j;
@Slf4j
@LiteflowComponent
public class RunningFlow {
@LiteflowMethod(value = LiteFlowMethodEnum.PROCESS, nodeId = "A")
public void processA(NodeComponent bind){
log.info("Process A");
}
@LiteflowMethod(value = LiteFlowMethodEnum.PROCESS, nodeId = "B")
public void processB(NodeComponent bind){
log.info("Process B");
}
}

View File

@@ -48,3 +48,6 @@ logging:
level:
# root: debug
org.springframework.ai: debug
liteflow:
print-banner: false
rule-source: config/flow.xml

View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<flow>
<chain name="chain_1">
SER(A,B)
</chain>
</flow>