Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 1da380ace3 | |||
| 5d888f648a |
6
pom.xml
6
pom.xml
@@ -51,6 +51,12 @@
|
||||
<groupId>net.datafaker</groupId>
|
||||
<artifactId>datafaker</artifactId>
|
||||
<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>
|
||||
<groupId>io.projectreactor.netty</groupId>
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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 {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -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");
|
||||
}
|
||||
}
|
||||
@@ -48,3 +48,6 @@ logging:
|
||||
level:
|
||||
# root: debug
|
||||
org.springframework.ai: debug
|
||||
liteflow:
|
||||
print-banner: false
|
||||
rule-source: config/flow.xml
|
||||
6
src/main/resources/config/flow.xml
Normal file
6
src/main/resources/config/flow.xml
Normal file
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<flow>
|
||||
<chain name="chain_1">
|
||||
SER(A,B)
|
||||
</chain>
|
||||
</flow>
|
||||
Reference in New Issue
Block a user