refactor(asynch): 重构异步模型配置和队列管理
This commit is contained in:
@@ -18,6 +18,38 @@ type CreateTaskRes struct {
|
||||
TaskID string `json:"taskId" dc:"任务ID"`
|
||||
}
|
||||
|
||||
type ModelTaskCallbackReq struct {
|
||||
g.Meta `path:"/modelCallback" method:"post" tags:"异步任务" summary:"模型任务回调通知"`
|
||||
TaskID string `json:"id" dc:"任务ID"`
|
||||
Status string `json:"status" dc:"queued/running/succeeded/failed/expired"`
|
||||
Content map[string]any `json:"content,omitempty" dc:"任务结果内容"`
|
||||
Usage map[string]any `json:"usage,omitempty" dc:"token用量"`
|
||||
}
|
||||
|
||||
type ModelTaskCallbackRes struct {
|
||||
Success bool `json:"success" dc:"是否接收成功"`
|
||||
}
|
||||
|
||||
// QueryPendingTasksReq 批量轮询请求
|
||||
type QueryPendingTasksReq struct {
|
||||
g.Meta `path:"/queryPending" method:"get" tags:"异步任务" summary:"批量轮询进行中的任务"`
|
||||
Limit int `p:"limit" json:"limit" dc:"查询数量,默认10"`
|
||||
}
|
||||
|
||||
// QueryPendingTasksRes 批量轮询响应
|
||||
type QueryPendingTasksRes struct {
|
||||
Total int `json:"total" dc:"本次查询数量"`
|
||||
Results []QueryTaskItem `json:"results" dc:"查询结果列表"`
|
||||
}
|
||||
|
||||
// QueryTaskItem 单个任务查询结果
|
||||
type QueryTaskItem struct {
|
||||
TaskID string `json:"taskId" dc:"任务ID"`
|
||||
Status string `json:"status" dc:"任务状态"`
|
||||
Content map[string]any `json:"content,omitempty" dc:"结果内容"`
|
||||
Usage map[string]any `json:"usage,omitempty" dc:"token用量"`
|
||||
}
|
||||
|
||||
// GetTaskResultReq 获取结果(只返回 oss 地址)
|
||||
type GetTaskResultReq struct {
|
||||
g.Meta `path:"/getTaskResult" method:"get" tags:"任务管理" summary:"获取任务结果" dc:"根据任务ID获取结果(只返回OSS地址)"`
|
||||
|
||||
Reference in New Issue
Block a user