admin
2025-06-06 9cd825aea53fa5ba0cda1485464af027e27f0ce4
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
package tech.aiflowy.ai.entity;
 
import tech.aiflowy.ai.entity.base.AiWorkflowBase;
import tech.aiflowy.ai.utils.TinyFlowConfigService;
import tech.aiflowy.common.util.SpringContextUtil;
import tech.aiflowy.common.util.StringUtil;
import com.agentsflex.core.llm.functions.Function;
import com.mybatisflex.annotation.Table;
import dev.tinyflow.core.Tinyflow;
 
/**
 * 实体类。
 *
 * @author michael
 * @since 2024-08-23
 */
 
@Table("tb_ai_workflow")
public class AiWorkflow extends AiWorkflowBase {
 
 
    public Tinyflow toTinyflow() {
        String jsonContent = this.getContent();
        if (StringUtil.noText(jsonContent)) {
            return null;
        }
 
        Tinyflow tinyflow = new Tinyflow(jsonContent);
        TinyFlowConfigService service = SpringContextUtil.getBean(TinyFlowConfigService.class);
        service.initProvidersAndNodeParsers(tinyflow);
        return tinyflow;
    }
 
 
 
    public Function toFunction() {
        return new AiWorkflowFunction(this);
    }
}