Files
ai-agent/workflow/model/entity/flow_execution.go
T
19904408334 14c88efe79 feat: 新增会话与结果管理功能及扩展字段
重构执行列表树状结构,扁平化日期节点下的输出项,新增会话列表查询、结果删除与软删除标记,引入扩展字段与模板配置,升级依赖版本。
2026-07-08 09:22:54 +08:00

72 lines
3.3 KiB
Go

package entity
import (
"ai-agent/workflow/consts/flow"
"gitea.redpowerfuture.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:"流程名称"`
NodeGroupId string `orm:"node_group_id" json:"nodeGroupId" description:"节点组ID"`
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"`
TotalTokens int `orm:"total_tokens" json:"totalTokens" description:"总token消耗"`
TotalFee int `orm:"total_fee" json:"totalFee" description:"总费用"`
SessionDel bool `orm:"session_del" json:"sessionDel" description:"会话是否删除"`
ResultDel bool `orm:"result_del" json:"resultDel" description:"结果是否删除"`
Extension map[string]interface{} `orm:"extension" json:"extension" description:"扩展字段"`
}
type flowExecutionCol struct {
beans.SQLBaseCol
FlowUserId string
FlowName string
NodeGroupId string
TriggerType string
DurationMs string
Status string
FlowContent string
NodeInputParams string
OutputParams string
ErrorMessage string
TraceId string
SessionId string
TotalTokens string
TotalFee string
SessionDel string
ResultDel string
Extension string
}
var FlowExecutionCol = flowExecutionCol{
SQLBaseCol: beans.DefSQLBaseCol,
FlowUserId: "flow_user_id",
FlowName: "flow_name",
NodeGroupId: "node_group_id",
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",
TotalTokens: "total_tokens",
TotalFee: "total_fee",
SessionDel: "session_del",
ResultDel: "result_del",
Extension: "extension",
}