package entity import "gitea.redpowerfuture.com/red-future/common/beans" // FlowAsyncTask 统一异步模型任务表:提交时写入(in-flight),结果回来更新; // 崩溃恢复靠持久化的 msg_topic 重订阅 NATS 拿回结果,避免重复调用模型 type FlowAsyncTask struct { beans.SQLBaseDO `orm:",inherit"` // NodeGroupId 所属逻辑运行(attempt)标识:全新/换参重跑=新组,续跑/恢复/自动重试=复用 exec 记录的组。 // 缓存唯一键以 (node_group_id, node_id, segment_index) 隔离,杜绝换参重跑软删墓碑与重跑同键写入冲突。 NodeGroupId string `orm:"node_group_id" json:"nodeGroupId" description:"所属逻辑运行(node_group_id)标识"` ExecutionId int64 `orm:"execution_id" json:"executionId" description:"所属执行ID(溯源,不参与唯一键)"` NodeId string `orm:"node_id" json:"nodeId" description:"所属节点ID"` SegmentIndex int `orm:"segment_index" json:"segmentIndex" description:"段序号;非段调用为-1"` ModelId int64 `orm:"model_id" json:"modelId" description:"模型ID"` TaskId int64 `orm:"task_id" json:"taskId" description:"model-gateway任务ID"` MsgTopic string `orm:"msg_topic" json:"msgTopic" description:"结果消息主题"` State int `orm:"state" json:"state" description:"0=in-flight,1=done,2=failed"` Result string `orm:"result" json:"result" description:"成功结果JSON(ModelCallRes)"` } type flowAsyncTaskCol struct { beans.SQLBaseCol NodeGroupId string ExecutionId string NodeId string SegmentIndex string ModelId string TaskId string MsgTopic string State string Result string } var FlowAsyncTaskCol = flowAsyncTaskCol{ SQLBaseCol: beans.DefSQLBaseCol, NodeGroupId: "node_group_id", ExecutionId: "execution_id", NodeId: "node_id", SegmentIndex: "segment_index", ModelId: "model_id", TaskId: "task_id", MsgTopic: "msg_topic", State: "state", Result: "result", }