feat: 新增工作流执行模块

新增流程执行记录的实体、DTO、DAO、控制器和服务层,支持工作流的执行、回调及结果树状列表查询;同时更新服务名称为 ai-agent。
This commit is contained in:
2026-05-12 13:34:28 +08:00
parent 2aec7fe30f
commit 7c26914353
42 changed files with 4146 additions and 11 deletions

View File

@@ -0,0 +1,235 @@
package flow
import (
"ai-agent/workflow/consts/flow"
"ai-agent/workflow/model/entity"
"gitea.com/red-future/common/beans"
"github.com/gogf/gf/v2/frame/g"
"github.com/gogf/gf/v2/os/gtime"
)
// NodeExecutionInput 节点执行入参(包含配置+表单架构)
type NodeExecutionInput struct {
Config *entity.FlowNode // 节点配置
Global *FlowExecutionInput `json:"-"`
}
// FlowExecutionInput 工作流执行入参(全程不变)
type FlowExecutionInput struct {
ExecutionId int64 `json:"executionId"`
ConfigMap map[string]*entity.FlowNode `json:"configMap"`
SessionId string `json:"sessionId" dc:"会话ID"`
Desc string `json:"desc"`
SkillName string `json:"skillName"`
FileUrl []string `json:"fileUrl"`
ExecutedNodes []string `json:"executedNodes"`
}
type ComposeMessagesReq struct {
ModelTypeId int `json:"modelTypeId"`
ModelName string `json:"modelName"`
SkillName string `json:"skillName"`
Form map[string]any `json:"form"`
UserForm map[string]any `json:"userForm"`
UserFiles []string `json:"userFiles"`
SessionId string `json:"sessionId" dc:"会话ID"`
IsBuild bool `json:"isBuild"`
Cause string `json:"cause"`
}
type ComposeMessagesRes struct {
Messages map[string]any `json:"messages"`
EpicycleId int64 `json:"epicycleId" dc:"轮次ID"`
}
type CreateTaskReq struct {
ModelName string `json:"modelName"`
ModelKey string `json:"modelKey"`
BizName string `json:"bizName"`
CallbackUrl string `json:"callbackUrl"`
InputRef string `json:"inputRef"`
RequestPayload map[string]any `json:"requestPayload"`
EpicycleId int64 `json:"epicycleId" dc:"轮次ID"`
}
type CreateTaskRes struct {
TaskId string `json:"taskId"`
}
type GetIsChatModelRes struct {
ModelName string `json:"modelName"`
ResponseBody map[string]any `json:"responseBody"`
}
type ModelCallbackReq struct {
g.Meta `path:"/modelCallback" method:"post" tags:"提示词处理" summary:"model-gateway 回调" dc:"model-gateway 成功后 GET 回调callbackUrl/{bizName}"`
TaskId string `p:"task_id" json:"task_id" v:"required#task_id不能为空" dc:"网关任务ID"`
State int `p:"state" json:"state" dc:"网关任务状态"`
OssFile string `p:"oss_file" json:"oss_file" dc:"结果文件地址"`
FileType string `p:"file_type" json:"file_type" dc:"结果文件类型"`
Text string `p:"text" json:"text" dc:"文本结果(可选,最多约 2000 字符)"`
}
type TaskCallback struct {
TaskID string `json:"taskId"`
State int `json:"state"` // 0排队中/1执行中/2成功/3失败/4已下载
OssFile string `json:"ossFile"`
FileType string `json:"fileType"`
Text string `json:"text"`
//ImgContent *Image `json:"imgContent"`
}
type Text struct {
Choices []struct {
FinishReason string `json:"finish_reason"`
Index int `json:"index"`
Message struct {
Content string `json:"content"`
Role string `json:"role"`
} `json:"message"`
} `json:"choices"`
Created int `json:"created"`
Id string `json:"id"`
Model string `json:"model"`
Object string `json:"object"`
Usage struct {
CompletionTokens int `json:"completion_tokens"`
PromptTokens int `json:"prompt_tokens"`
PromptTokensDetails struct {
CachedTokens int `json:"cached_tokens"`
}
TotalTokens int `json:"total_tokens"`
} `json:"usage"`
}
type Image struct {
Output struct {
Choices []struct {
FinishReason string `json:"finish_reason"`
Message struct {
Content []struct {
Image string `json:"image"`
} `json:"content"`
Role string `json:"role"`
} `json:"message"`
} `json:"choices"`
} `json:"output"`
Usage struct {
Height int `json:"height"`
ImageCount int `json:"image_count"`
Width int `json:"width"`
} `json:"usage"`
RequestId string `json:"request_id"`
}
//=============================================================================
type ExecuteReq struct {
g.Meta `path:"/execute" method:"post" tags:"任务管理" summary:"执行任务" dc:"执行任务"`
FlowId int64 `json:"flowId" dc:"用户流程ID"`
FlowName string `json:"flowName"`
FlowContent *entity.FlowInfo `json:"flowContent" description:"流程内容"`
NodeInputParams []*entity.FlowNode `json:"nodeInputParams" description:"节点输入参数"`
SessionId string `json:"sessionId" dc:"会话ID"`
Desc string `json:"desc"`
SkillName string `json:"skillName"`
FileUrl []string `json:"fileUrl"`
}
type ExecuteRes struct {
Id int64 `json:"id,string" dc:"执行记录ID用于查询执行状态和结果"`
}
type CancelReq struct {
g.Meta `path:"/cancel" method:"get" tags:"任务管理" summary:"取消任务" dc:"取消任务"`
FlowId int64 `json:"flowId" dc:"用户流程ID"`
}
type CreateFlowExecutionReq struct {
FlowUserId int64 `json:"flowUserId" description:"流程ID"`
FlowName string `json:"flowName"`
TriggerType flow.FlowExecutionTriggerType `json:"triggerType" description:"触发类型"`
DurationMs int64 `json:"durationMs" description:"执行时长(毫秒)"`
Status flow.FlowExecutionStatus `json:"status" description:"状态:1-运行中,2-成功,3-失败"`
FlowContent *entity.FlowInfo `json:"flowContent" description:"流程内容"`
NodeInputParams []*entity.FlowNode `json:"nodeInputParams" description:"节点输入参数"`
OutputParams []map[string]interface{} `json:"outputParams" description:"输出参数"`
ErrorMessage string `json:"errorMessage" description:"错误信息"`
TraceId string `json:"traceId" description:"跟踪ID"`
SessionId string `json:"sessionId" dc:"会话ID"`
}
type CreateFlowExecutionRes struct {
Id int64 `json:"id,string"`
}
type UpdateFlowExecutionReq struct {
Id int64 `json:"id" v:"required#ID不能为空"`
DurationMs int64 `json:"durationMs" description:"执行时长(毫秒)"`
Status flow.FlowExecutionStatus `json:"status" description:"状态:1-运行中,2-成功,3-失败"`
OutputParams []map[string]interface{} `json:"outputParams" description:"输出参数"`
ErrorMessage string `json:"errorMessage" description:"错误信息"`
TraceId string `json:"traceId" description:"跟踪ID"`
}
type GetFlowExecutionReq struct {
g.Meta `path:"/get" method:"get" tags:"任务管理" summary:"获取任务详情" dc:"获取任务详情"`
Id int64 `json:"id" v:"required#ID不能为空"`
SessionId string `json:"sessionId" dc:"会话ID"`
}
type ListFlowExecutionReq struct {
g.Meta `path:"/list" method:"get" tags:"任务管理" summary:"任务列表" dc:"任务列表"`
Page *beans.Page `json:"page"`
Creator string `json:"creator"`
}
type ListFlowExecutionRes struct {
List []*VOFlowExecution `json:"list"`
Total int `json:"total"`
}
type VOFlowExecution struct {
Id int64 `json:"id,string" dc:"id"`
FlowUserId int64 `json:"flowUserId,string" description:"流程ID"`
FlowName string `json:"flowName"`
TriggerType flow.FlowExecutionTriggerType `json:"triggerType" description:"触发类型"`
DurationMs int64 `json:"durationMs" description:"执行时长(毫秒)"`
Status flow.FlowExecutionStatus `json:"status" description:"状态:1-运行中,2-成功,3-失败"`
FlowContent *entity.FlowInfo `json:"flowContent" description:"流程内容"`
NodeInputParams []*entity.FlowNode `json:"nodeInputParams" description:"节点输入参数"`
OutputParams []map[string]interface{} `json:"outputParams" description:"输出参数"`
ErrorMessage string `json:"errorMessage" description:"错误信息"`
TraceId string `json:"traceId" description:"跟踪ID"`
CreatedAt *gtime.Time `json:"createdAt" dc:"创建时间"`
UpdatedAt *gtime.Time `json:"updatedAt" dc:"更新时间"`
}
// ========== 核心:构建树状结构 ==========
// 定义树结构
type OutputItem struct {
Timestamp string `json:"timestamp" description:"时间戳key"`
Content string `json:"content" description:"内容值"`
Label string `json:"label" description:"后缀+数字标号"`
}
type FlowNode struct {
FlowName string `json:"flowName" description:"流程名称"`
FlowId int64 `json:"flowId,string" description:"流程ID"`
SessionId string `json:"sessionId" description:"会话ID"`
Items []OutputItem `json:"items" description:"输出项列表"`
}
type DateNode struct {
CreateDate string `json:"createDate" description:"创建日期"`
Flows []FlowNode `json:"flows" description:"流程列表"`
}
// 最终树结构返回体
type ListFlowExecutionTreeRes struct {
Tree []DateNode `json:"tree"`
ImgAddressPrefix string `json:"imgAddressPrefix"`
}

View File

@@ -0,0 +1,76 @@
package flow
import (
"ai-agent/workflow/consts/flow"
"ai-agent/workflow/model/entity"
"gitea.com/red-future/common/beans"
"github.com/gogf/gf/v2/frame/g"
"github.com/gogf/gf/v2/os/gtime"
)
type CreateFlowTemplateReq struct {
g.Meta `path:"/create" method:"post" tags:"系统流程管理" summary:"创建系统流程" dc:"创建系统流程"`
FlowTemplateName string `json:"flowTemplateName" description:"流程模板名称"`
Description string `json:"description" description:"流程描述"`
CategoryCode string `json:"categoryCode" description:"流程分类"`
CategoryName string `json:"categoryName" description:"流程分类名称"`
FlowContent *entity.FlowInfo `json:"flowContent" description:"流程内容"`
NodeInputParams []*entity.FlowNode `json:"nodeInputParams" description:"节点输入参数"`
Status flow.FlowTemplateStatus `description:"流程状态1启用/0停用"`
}
type CreateFlowTemplateRes struct {
Id int64 `json:"id,string"`
}
type UpdateFlowTemplateReq struct {
g.Meta `path:"/update" method:"put" tags:"系统流程管理" summary:"更新系统流程" dc:"更新系统流程"`
Id int64 `json:"id" v:"required#ID不能为空"`
FlowTemplateName string `json:"flowTemplateName" description:"流程模板名称"`
Description string `json:"description" description:"流程描述"`
CategoryCode string `json:"categoryCode" description:"流程分类"`
CategoryName string `json:"categoryName" description:"流程分类名称"`
FlowContent *entity.FlowInfo `json:"flowContent" description:"流程内容"`
NodeInputParams []*entity.FlowNode `json:"nodeInputParams" description:"节点输入参数"`
Status flow.FlowTemplateStatus `description:"流程状态1启用/0停用"`
}
type DeleteFlowTemplateReq struct {
g.Meta `path:"/delete" method:"delete" tags:"系统流程管理" summary:"删除系统流程" dc:"删除系统流程"`
Id int64 `json:"id" v:"required#ID不能为空"`
}
type GetFlowTemplateReq struct {
g.Meta `path:"/get" method:"get" tags:"系统流程管理" summary:"获取系统流程详情" dc:"获取系统流程详情"`
Id int64 `json:"id" v:"required#ID不能为空"`
}
type ListFlowTemplateReq struct {
g.Meta `path:"/list" method:"get" tags:"系统流程管理" summary:"获取系统流程列表" dc:"分页查询系统流程列表,支持多条件筛选"`
Page *beans.Page `json:"page"`
Keyword string `json:"keyword" dc:"关键词搜索"`
}
type ListFlowTemplateRes struct {
List []*FlowTemplateVO `json:"list"`
Total int `json:"total"`
}
type FlowTemplateVO struct {
Id int64 `json:"id,string" dc:"id"`
FlowTemplateName string `json:"flowTemplateName" description:"流程模板名称"`
Description string `json:"description" description:"流程描述"`
CategoryCode string `json:"categoryCode" description:"流程分类"`
CategoryName string `json:"categoryName" description:"流程分类名称"`
FlowContent *entity.FlowInfo `json:"flowContent" description:"流程内容"`
NodeInputParams []*entity.FlowNode `json:"nodeInputParams" description:"节点输入参数"`
Status flow.FlowTemplateStatus `description:"流程状态1启用/0停用"`
CreatedAt *gtime.Time `json:"createdAt" dc:"创建时间"`
UpdatedAt *gtime.Time `json:"updatedAt" dc:"更新时间"`
}

View File

@@ -0,0 +1,80 @@
package flow
import (
"ai-agent/workflow/consts/flow"
"ai-agent/workflow/model/entity"
"gitea.com/red-future/common/beans"
"github.com/gogf/gf/v2/frame/g"
"github.com/gogf/gf/v2/os/gtime"
)
type CreateFlowUserReq struct {
g.Meta `path:"/create" method:"post" tags:"用户流程管理" summary:"创建用户流程" dc:"创建用户流程"`
FlowName string `json:"flowName" description:"流程名称"`
Description string `json:"description" description:"流程描述"`
FlowContent *entity.FlowInfo `json:"flowContent" description:"流程内容"`
NodeInputParams []*entity.FlowNode `json:"nodeInputParams" description:"节点输入参数"`
AccessLevel flow.FlowUserAccessLevel `json:"accessLevel" description:"访问权限1私有2团队3公开"`
SourceFlowTemplateId int64 `json:"sourceFlowTemplateId" description:"来源流程模板ID"`
}
type CreateFlowUserRes struct {
Id int64 `json:"id,string"`
}
type UpdateFlowUserReq struct {
g.Meta `path:"/update" method:"put" tags:"用户流程管理" summary:"更新用户流程" dc:"更新用户流程"`
Id int64 `json:"id" v:"required#ID不能为空"`
FlowName string `json:"flowName" description:"流程名称"`
Description string `json:"description" description:"流程描述"`
FlowContent *entity.FlowInfo `json:"flowContent" description:"流程内容"`
NodeInputParams []*entity.FlowNode `json:"nodeInputParams" description:"节点输入参数"`
AccessLevel flow.FlowUserAccessLevel `json:"accessLevel" description:"访问权限1私有2团队3公开"`
SourceFlowTemplateId int64 `json:"sourceFlowTemplateId" description:"来源流程模板ID"`
}
type DeleteFlowUserReq struct {
g.Meta `path:"/delete" method:"delete" tags:"用户流程管理" summary:"删除用户流程" dc:"删除用户流程"`
Id int64 `json:"id" v:"required#ID不能为空"`
}
type GetFlowUserReq struct {
g.Meta `path:"/get" method:"get" tags:"用户流程管理" summary:"获取用户流程详情" dc:"获取用户流程详情"`
Id int64 `json:"id" v:"required#ID不能为空"`
}
type ListFlowUserReq struct {
g.Meta `path:"/list" method:"get" tags:"用户流程管理" summary:"获取用户流程列表" dc:"分页查询用户流程列表,支持多条件筛选"`
Page *beans.Page `json:"page"`
Creator string `json:"creator"`
Keyword string `json:"keyword" dc:"关键词搜索"`
}
type ListFlowUserRes struct {
List []*FlowUserVO `json:"list"`
Total int `json:"total"`
}
type FlowUserVO struct {
Id int64 `json:"id,string" dc:"id"`
FlowName string `json:"flowName" description:"流程名称"`
Description string `json:"description" description:"流程描述"`
FlowContent *entity.FlowInfo `json:"flowContent" description:"流程内容"`
NodeInputParams []*entity.FlowNode `json:"nodeInputParams" description:"节点输入参数"`
AccessLevel flow.FlowUserAccessLevel `json:"accessLevel" description:"访问权限1私有2团队3公开"`
SourceFlowTemplateId int64 `json:"sourceFlowTemplateId,string" description:"来源流程模板ID"`
CreatedAt *gtime.Time `json:"createdAt" dc:"创建时间"`
UpdatedAt *gtime.Time `json:"updatedAt" dc:"更新时间"`
}
type ListFlowRes struct {
ListFlowUserRes *ListFlowUserRes `json:"listFlowUserRes"`
ListFlowTemplateRes *ListFlowTemplateRes `json:"listFlowTemplateRes"`
IsAdmin bool `json:"isAdmin"`
}

View File

@@ -0,0 +1,29 @@
package node
import (
"ai-agent/workflow/consts/node"
"github.com/gogf/gf/v2/frame/g"
)
type WorkflowNodeTreeReq struct {
g.Meta `path:"/list" method:"get" tags:"节点组件库管理" summary:"节点组件库列表" dc:"节点组件库列表"`
Creator string `json:"creator"`
}
type WorkflowNodeTreeRes struct {
Groups []node.NodeGroupItem `json:"groups"`
}
type TypeGroup struct {
TypeId int `json:"typeId"`
Type string `json:"type"`
Items []ModelItem `json:"items"`
}
type ModelItem struct {
ID int64 `json:"id"`
Name string `json:"name"`
Form []node.NodeFormField `json:"form"`
}

View File

@@ -0,0 +1,50 @@
package skill
import (
"gitea.com/red-future/common/beans"
"github.com/gogf/gf/v2/frame/g"
"github.com/gogf/gf/v2/os/gtime"
)
type CreateSkillTemplateReq struct {
g.Meta `path:"/create" method:"post" tags:"Skill技能管理" summary:"创建Skill技能" dc:"创建Skill技能"`
Name string `json:"name"`
Description string `json:"description"`
Category string `json:"category"`
FileName string `json:"fileName"`
FileUrl string `json:"fileUrl"`
}
type CreateSkillTemplateRes struct {
Id int64 `json:"id,string"`
}
type DeleteSkillTemplateReq struct {
g.Meta `path:"/delete" method:"delete" tags:"Skill技能管理" summary:"删除Skill技能" dc:"删除Skill技能"`
Id int64 `json:"id" v:"required#ID不能为空"`
}
type ListSkillTemplateReq struct {
g.Meta `path:"/list" method:"get" tags:"Skill技能管理" summary:"Skill技能列表" dc:"Skill技能列表"`
Page *beans.Page `json:"page"`
Keyword string `json:"keyword" dc:"关键词搜索"`
}
type ListSkillTemplateRes struct {
List []*SkillTemplateVO `json:"list"`
Total int `json:"total"`
}
type SkillTemplateVO struct {
Id int64 `json:"id,string" dc:"id"`
Name string `json:"name"`
Description string `json:"description"`
Category string `json:"category"`
FileName string `json:"fileName"`
FileUrl string `json:"fileUrl"`
CreatedAt *gtime.Time `json:"createdAt" dc:"创建时间"`
UpdatedAt *gtime.Time `json:"updatedAt" dc:"更新时间"`
}

View File

@@ -0,0 +1,59 @@
package skill
import (
"gitea.com/red-future/common/beans"
"github.com/gogf/gf/v2/frame/g"
"github.com/gogf/gf/v2/os/gtime"
)
type CreateSkillUserReq struct {
g.Meta `path:"/create" method:"post" tags:"Skill用户技能管理" summary:"创建Skill用户技能" dc:"创建Skill用户技能"`
Name string `json:"name"`
Description string `json:"description"`
Category string `json:"category"`
FileName string `json:"fileName"`
FileUrl string `json:"fileUrl"`
}
type CreateSkillUserRes struct {
Id int64 `json:"id,string"`
}
type DeleteSkillUserReq struct {
g.Meta `path:"/delete" method:"delete" tags:"Skill用户技能管理" summary:"删除Skill用户技能" dc:"删除Skill用户技能"`
Id int64 `json:"id" v:"required#ID不能为空"`
}
type ListSkillReq struct {
g.Meta `path:"/list" method:"get" tags:"Skill用户技能管理" summary:"Skill用户技能列表" dc:"Skill用户技能列表"`
Page *beans.Page `json:"page"`
Creator string `json:"creator"`
Keyword string `json:"keyword" dc:"关键词搜索"`
}
type ListSkillUserReq struct {
g.Meta `path:"/listUser" method:"get" tags:"Skill用户技能管理" summary:"Skill仅用户技能列表" dc:"Skill仅用户技能列表"`
Page *beans.Page `json:"page"`
Creator string `json:"creator"`
Keyword string `json:"keyword" dc:"关键词搜索"`
}
type ListSkillUserRes struct {
List []*SkillUserVO `json:"list"`
Total int `json:"total"`
}
type SkillUserVO struct {
Id int64 `json:"id,string" dc:"id"`
Name string `json:"name"`
Description string `json:"description"`
Category string `json:"category"`
FileName string `json:"fileName"`
FileUrl string `json:"fileUrl"`
CreatedAt *gtime.Time `json:"createdAt" dc:"创建时间"`
UpdatedAt *gtime.Time `json:"updatedAt" dc:"更新时间"`
}

View File

@@ -0,0 +1,53 @@
package entity
import (
"ai-agent/workflow/consts/flow"
"gitea.com/red-future/common/beans"
)
type FlowExecution struct {
beans.SQLBaseDO `orm:",inherit"` // 嵌入基础字段Id, TenantId, Creator, CreatedAt, Updater, UpdatedAt, DeletedAt
// 业务字段
FlowUserId int64 `orm:"flow_user_id" json:"flowUserId" description:"流程ID"`
FlowName string `orm:"flow_name" json:"flowName" description:"流程名称"`
TriggerType flow.FlowExecutionTriggerType `orm:"trigger_type" json:"triggerType" description:"触发类型"`
DurationMs int64 `orm:"duration_ms" json:"durationMs" description:"执行时长(毫秒)"`
Status flow.FlowExecutionStatus `orm:"status" json:"status" description:"状态:1-运行中,2-成功,3-失败"`
FlowContent *FlowInfo `orm:"flow_content" json:"flowContent" description:"流程内容"`
NodeInputParams []*FlowNode `orm:"node_input_params" json:"nodeInputParams" description:"节点输入参数"`
OutputParams []map[string]interface{} `orm:"output_params" json:"outputParams" description:"输出参数"`
ErrorMessage string `orm:"error_message" json:"errorMessage" description:"错误信息"`
TraceId string `orm:"trace_id" json:"traceId" description:"跟踪ID"`
SessionId string `orm:"session_id" json:"sessionId" description:"会话ID"`
}
type flowExecutionCol struct {
beans.SQLBaseCol
FlowUserId string
FlowName string
TriggerType string
DurationMs string
Status string
FlowContent string
NodeInputParams string
OutputParams string
ErrorMessage string
TraceId string
SessionId string
}
var FlowExecutionCol = flowExecutionCol{
SQLBaseCol: beans.DefSQLBaseCol,
FlowUserId: "flow_user_id",
FlowName: "flow_name",
TriggerType: "trigger_type",
DurationMs: "duration_ms",
Status: "status",
FlowContent: "flow_content",
NodeInputParams: "node_input_params",
OutputParams: "output_params",
ErrorMessage: "error_message",
TraceId: "trace_id",
SessionId: "session_id",
}

View File

@@ -0,0 +1,41 @@
package entity
import (
"ai-agent/workflow/consts/flow"
"gitea.com/red-future/common/beans"
)
type FlowTemplate struct {
beans.SQLBaseDO `orm:",inherit"` // 嵌入基础字段Id, TenantId, Creator, CreatedAt, Updater, UpdatedAt, DeletedAt
// 业务字段
FlowTemplateName string `orm:"flow_template_name" json:"flowTemplateName" description:"流程模板名称"`
Description string `orm:"description" json:"description" description:"流程描述"`
CategoryCode string `orm:"category_code" json:"categoryCode" description:"流程分类"`
CategoryName string `orm:"category_name" json:"categoryName" description:"流程分类名称"`
FlowContent *FlowInfo `orm:"flow_content" json:"flowContent" description:"流程内容"`
NodeInputParams []*FlowNode `orm:"node_input_params" json:"nodeInputParams" description:"节点输入参数"`
Status flow.FlowTemplateStatus `orm:"status" json:"status" description:"流程状态1启用/0停用"`
}
type flowTemplateCol struct {
beans.SQLBaseCol
FlowTemplateName string
Description string
CategoryCode string
CategoryName string
FlowContent string
NodeInputParams string
Status string
}
var FlowTemplateCol = flowTemplateCol{
SQLBaseCol: beans.DefSQLBaseCol,
FlowTemplateName: "flow_template_name",
Description: "description",
CategoryCode: "category_code",
CategoryName: "category_name",
FlowContent: "flow_content",
NodeInputParams: "node_input_params",
Status: "status",
}

View File

@@ -0,0 +1,70 @@
package entity
import (
"ai-agent/workflow/consts/flow"
"ai-agent/workflow/consts/node"
"gitea.com/red-future/common/beans"
)
type FlowInfo struct {
Version string `json:"version"`
StartNodeId string `json:"startNodeId"`
Nodes []FlowNode `json:"nodes"`
Edges []FlowEdge `json:"edges"`
}
type FlowNode struct {
Id string `json:"id"`
NodeCode node.NodeType `json:"nodeCode"`
Name string `json:"name"`
Config map[string]interface{} `json:"config"`
SkillName string `json:"skillName"`
InputSource []FlowNodeInputSource `json:"inputSource"` // 前端指定来源节点ID
FormConfig []node.NodeFormField `json:"formConfig"`
ModelConfig node.ModelItem `json:"modelConfig"`
OutputResult []node.NodeFormField `json:"outputResult" ds:"节点输出结果"`
}
type FlowNodeInputSource struct {
NodeId string `json:"nodeId"`
QuoteOutput bool `json:"quoteOutput"`
Field []string `json:"field"`
}
type FlowEdge struct {
Id string `json:"id"`
From string `json:"from"`
To string `json:"to"`
}
type FlowUser struct {
beans.SQLBaseDO `orm:",inherit"` // 嵌入基础字段Id, TenantId, Creator, CreatedAt, Updater, UpdatedAt, DeletedAt
// 业务字段
FlowName string `orm:"flow_name" json:"flowName" description:"流程名称"`
Description string `orm:"description" json:"description" description:"流程描述"`
FlowContent *FlowInfo `orm:"flow_content" json:"flowContent" description:"流程内容"`
NodeInputParams []*FlowNode `orm:"node_input_params" json:"nodeInputParams" description:"节点输入参数"`
AccessLevel flow.FlowUserAccessLevel `orm:"access_level" json:"accessLevel" description:"访问权限1私有2团队3公开"`
SourceFlowTemplateId int64 `orm:"source_flow_template_id" json:"sourceFlowTemplateId" description:"来源流程模板ID"`
}
type flowUserCol struct {
beans.SQLBaseCol
FlowName string
Description string
FlowContent string
NodeInputParams string
AccessLevel string
SourceFlowTemplateId string
}
var FlowUserCol = flowUserCol{
SQLBaseCol: beans.DefSQLBaseCol,
FlowName: "flow_name",
Description: "description",
FlowContent: "flow_content",
NodeInputParams: "node_input_params",
AccessLevel: "access_level",
SourceFlowTemplateId: "source_flow_template_id",
}

View File

@@ -0,0 +1,33 @@
package entity
import (
"gitea.com/red-future/common/beans"
)
type SkillTemplate struct {
beans.SQLBaseDO `orm:",inherit"` // 嵌入基础字段Id, TenantId, Creator, CreatedAt, Updater, UpdatedAt, DeletedAt
Name string `orm:"name" json:"name"`
Description string `orm:"description" json:"description"`
Category string `orm:"category" json:"category"`
FileName string `orm:"file_name" json:"fileName"`
FileUrl string `orm:"file_url" json:"fileUrl"`
}
type skillTemplateCol struct {
beans.SQLBaseCol
Name string
Description string
Category string
FileName string
FileUrl string
}
var SkillTemplateCol = skillTemplateCol{
SQLBaseCol: beans.DefSQLBaseCol,
Name: "name",
Description: "description",
Category: "category",
FileName: "file_name",
FileUrl: "file_url",
}

View File

@@ -0,0 +1,31 @@
package entity
import "gitea.com/red-future/common/beans"
type SkillUser struct {
beans.SQLBaseDO `orm:",inherit"` // 嵌入基础字段Id, TenantId, Creator, CreatedAt, Updater, UpdatedAt, DeletedAt
Name string `orm:"name" json:"name"`
Description string `orm:"description" json:"description"`
Category string `orm:"category" json:"category"`
FileName string `orm:"file_name" json:"fileName"`
FileUrl string `orm:"file_url" json:"fileUrl"`
}
type skillUserCol struct {
beans.SQLBaseCol
Name string
Description string
Category string
FileName string
FileUrl string
}
var SkillUserCol = skillUserCol{
SQLBaseCol: beans.DefSQLBaseCol,
Name: "name",
Description: "description",
Category: "category",
FileName: "file_name",
FileUrl: "file_url",
}