Compare commits

2 Commits

Author SHA1 Message Date
1da380ace3 测试并行 2025-03-02 23:48:46 +08:00
5d888f648a 增加并行框架 2025-03-02 23:14:49 +08:00
6 changed files with 65 additions and 0 deletions

View File

@@ -51,6 +51,12 @@
<groupId>net.datafaker</groupId> <groupId>net.datafaker</groupId>
<artifactId>datafaker</artifactId> <artifactId>datafaker</artifactId>
<version>2.4.2</version> <version>2.4.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.yomahub</groupId>
<artifactId>liteflow-spring-boot-starter</artifactId>
<version>2.13.0</version>
</dependency> </dependency>
<!--<dependency> <!--<dependency>
<groupId>io.projectreactor.netty</groupId> <groupId>io.projectreactor.netty</groupId>

View File

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

View File

@@ -0,0 +1,21 @@
package com.lanyuanxiaoyao.ai.analysis.flow;
import com.yomahub.liteflow.annotation.LiteflowComponent;
import com.yomahub.liteflow.core.NodeComponent;
import lombok.extern.slf4j.Slf4j;
import org.springframework.ai.chat.client.ChatClient;
@Slf4j
@LiteflowComponent
public class ChartNode extends NodeComponent {
private final ChatClient client;
public ChartNode(ChatClient.Builder builder) {
this.client = builder.build();
}
@Override
public void process() throws Exception {
}
}

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: level:
# root: debug # root: debug
org.springframework.ai: 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>