feat: 新增工作流执行模块
新增流程执行记录的实体、DTO、DAO、控制器和服务层,支持工作流的执行、回调及结果树状列表查询;同时更新服务名称为 ai-agent。
This commit is contained in:
26
workflow/controller/flow/flow_execution_controller.go
Normal file
26
workflow/controller/flow/flow_execution_controller.go
Normal file
@@ -0,0 +1,26 @@
|
||||
package flow
|
||||
|
||||
import (
|
||||
flowDto "ai-agent/workflow/model/dto/flow"
|
||||
flowService "ai-agent/workflow/service/flow"
|
||||
"context"
|
||||
|
||||
"gitea.com/red-future/common/beans"
|
||||
)
|
||||
|
||||
type flowExecution struct{}
|
||||
|
||||
var FlowExecution = new(flowExecution)
|
||||
|
||||
func (c *flowExecution) Execute(ctx context.Context, req *flowDto.ExecuteReq) (res *flowDto.ExecuteRes, err error) {
|
||||
return flowService.FlowExecutionService.Execute(ctx, req)
|
||||
}
|
||||
|
||||
func (c *flowExecution) ModelCallback(ctx context.Context, req *flowDto.ModelCallbackReq) (res *beans.ResponseEmpty, err error) {
|
||||
err = flowService.FlowExecutionService.ModelCallback(ctx, req)
|
||||
return
|
||||
}
|
||||
|
||||
func (c *flowExecution) List(ctx context.Context, req *flowDto.ListFlowExecutionReq) (res *flowDto.ListFlowExecutionTreeRes, err error) {
|
||||
return flowService.FlowExecutionService.List(ctx, req)
|
||||
}
|
||||
41
workflow/controller/flow/flow_template_controller.go
Normal file
41
workflow/controller/flow/flow_template_controller.go
Normal file
@@ -0,0 +1,41 @@
|
||||
package flow
|
||||
|
||||
import (
|
||||
flowDto "ai-agent/workflow/model/dto/flow"
|
||||
flowService "ai-agent/workflow/service/flow"
|
||||
"context"
|
||||
|
||||
"gitea.com/red-future/common/beans"
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
)
|
||||
|
||||
type flowTemplate struct{}
|
||||
|
||||
var FlowTemplate = new(flowTemplate)
|
||||
|
||||
func (c *flowTemplate) Create(ctx context.Context, req *flowDto.CreateFlowTemplateReq) (res *flowDto.CreateFlowTemplateRes, err error) {
|
||||
res, err = flowService.FlowTemplateService.Create(ctx, req)
|
||||
return
|
||||
}
|
||||
|
||||
func (c *flowTemplate) Update(ctx context.Context, req *flowDto.UpdateFlowTemplateReq) (res *beans.ResponseEmpty, err error) {
|
||||
err = flowService.FlowTemplateService.Update(ctx, req)
|
||||
return
|
||||
}
|
||||
|
||||
func (c *flowTemplate) Delete(ctx context.Context, req *flowDto.DeleteFlowTemplateReq) (res *beans.ResponseEmpty, err error) {
|
||||
err = flowService.FlowTemplateService.Delete(ctx, req)
|
||||
return
|
||||
}
|
||||
|
||||
func (c *flowTemplate) Get(ctx context.Context, req *flowDto.GetFlowTemplateReq) (res *flowDto.FlowTemplateVO, err error) {
|
||||
return flowService.FlowTemplateService.Get(ctx, req)
|
||||
}
|
||||
|
||||
func (c *flowTemplate) List(ctx context.Context, req *flowDto.ListFlowTemplateReq) (res *flowDto.ListFlowTemplateRes, err error) {
|
||||
if !g.IsEmpty(req.Page) {
|
||||
req.Page = &beans.Page{PageNum: 1, PageSize: 20}
|
||||
}
|
||||
res, err = flowService.FlowTemplateService.List(ctx, req)
|
||||
return
|
||||
}
|
||||
41
workflow/controller/flow/flow_user_controller.go
Normal file
41
workflow/controller/flow/flow_user_controller.go
Normal file
@@ -0,0 +1,41 @@
|
||||
package flow
|
||||
|
||||
import (
|
||||
flowDto "ai-agent/workflow/model/dto/flow"
|
||||
flowService "ai-agent/workflow/service/flow"
|
||||
"context"
|
||||
|
||||
"gitea.com/red-future/common/beans"
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
)
|
||||
|
||||
type flowUser struct{}
|
||||
|
||||
var FlowUser = new(flowUser)
|
||||
|
||||
func (c *flowUser) Create(ctx context.Context, req *flowDto.CreateFlowUserReq) (res *flowDto.CreateFlowUserRes, err error) {
|
||||
res, err = flowService.FlowUserService.Create(ctx, req)
|
||||
return
|
||||
}
|
||||
|
||||
func (c *flowUser) Update(ctx context.Context, req *flowDto.UpdateFlowUserReq) (res *beans.ResponseEmpty, err error) {
|
||||
err = flowService.FlowUserService.Update(ctx, req)
|
||||
return
|
||||
}
|
||||
|
||||
func (c *flowUser) Delete(ctx context.Context, req *flowDto.DeleteFlowUserReq) (res *beans.ResponseEmpty, err error) {
|
||||
err = flowService.FlowUserService.Delete(ctx, req)
|
||||
return
|
||||
}
|
||||
|
||||
func (c *flowUser) Get(ctx context.Context, req *flowDto.GetFlowUserReq) (res *flowDto.FlowUserVO, err error) {
|
||||
return flowService.FlowUserService.Get(ctx, req)
|
||||
}
|
||||
|
||||
func (c *flowUser) List(ctx context.Context, req *flowDto.ListFlowUserReq) (res *flowDto.ListFlowRes, err error) {
|
||||
if !g.IsEmpty(req.Page) {
|
||||
req.Page = &beans.Page{PageNum: 1, PageSize: 20}
|
||||
}
|
||||
res, err = flowService.FlowUserService.List(ctx, req)
|
||||
return
|
||||
}
|
||||
Reference in New Issue
Block a user