package entity import ( "ai-agent/workflow/consts/node" "gitea.redpowerfuture.com/red-future/common/beans" ) // NodeExecution 节点执行记录 // 记录每个节点的入参、出参、token消耗、执行状态等信息 type NodeExecution struct { beans.SQLBaseDO `orm:",inherit"` // 嵌入基础字段:Id, TenantId, Creator, CreatedAt, Updater, UpdatedAt, DeletedAt FlowExecutionId int64 `orm:"flow_execution_id" json:"flowExecutionId" description:"流程执行ID"` NodeId string `orm:"node_id" json:"nodeId" description:"节点ID"` NodeName string `orm:"node_name" json:"nodeName" description:"节点名称"` NodeGroupId string `orm:"node_group_id" json:"nodeGroupId" description:"节点组ID"` InputParams map[string]interface{} `orm:"input_params" json:"inputParams" description:"节点输入参数"` InputParamsPath string `orm:"input_params_path" json:"inputParamsPath" description:"节点输入参数路径"` OutputParams map[string]interface{} `orm:"output_params" json:"outputParams" description:"节点输出参数"` OutputParamsPath string `orm:"output_params_path" json:"outputParamsPath" description:"节点输出参数路径"` PromptTokens int `orm:"prompt_tokens" json:"promptTokens" description:"提示词token消耗"` CompletionTokens int `orm:"completion_tokens" json:"completionTokens" description:"补全token消耗"` TotalTokens int `orm:"total_tokens" json:"totalTokens" description:"总token消耗"` TokenInfo []map[string]interface{} `orm:"token_info" json:"tokenInfo" description:"token信息"` Status node.NodeExecutionStatus `orm:"status" json:"status" description:"执行状态:1-运行中,2-成功,3-失败,4-暂停,5-等待执行"` DurationMs int64 `orm:"duration_ms" json:"durationMs" description:"执行时长(毫秒)"` ErrorMessage string `orm:"error_message" json:"errorMessage" description:"错误信息"` } type nodeExecutionCol struct { beans.SQLBaseCol FlowExecutionId string NodeId string NodeName string NodeGroupId string InputParams string InputParamsPath string OutputParams string OutputParamsPath string PromptTokens string CompletionTokens string TotalTokens string TokenInfo string Status string DurationMs string ErrorMessage string } var NodeExecutionCol = nodeExecutionCol{ SQLBaseCol: beans.DefSQLBaseCol, FlowExecutionId: "flow_execution_id", NodeId: "node_id", NodeName: "node_name", NodeGroupId: "node_group_id", InputParams: "input_params", InputParamsPath: "input_params_path", OutputParams: "output_params", OutputParamsPath: "output_params_path", PromptTokens: "prompt_tokens", CompletionTokens: "completion_tokens", TotalTokens: "total_tokens", TokenInfo: "token_info", Status: "status", DurationMs: "duration_ms", ErrorMessage: "error_message", }