2026-05-25 16:38:46 +08:00
|
|
|
package model
|
|
|
|
|
|
|
|
|
|
import "time"
|
|
|
|
|
|
|
|
|
|
// Task 任务数据模型,对应数据库表。
|
|
|
|
|
type Task struct {
|
2026-05-25 17:48:31 +08:00
|
|
|
ID uint `gorm:"primaryKey" json:"id"`
|
|
|
|
|
ExternalID string `gorm:"size:100;index" json:"externalId,omitempty"` // 外部任务ID,关联内存中的taskID
|
|
|
|
|
ProjectID uint `gorm:"index" json:"-"`
|
|
|
|
|
Prompt string `gorm:"type:text" json:"prompt"`
|
|
|
|
|
AssetType string `gorm:"size:50" json:"assetType"`
|
|
|
|
|
Status string `gorm:"size:20;default:'pending'" json:"status"`
|
|
|
|
|
Stage string `gorm:"size:50" json:"stage,omitempty"`
|
|
|
|
|
Progress int `gorm:"default:0" json:"progress"`
|
|
|
|
|
RetryCount int `gorm:"default:0" json:"retryCount"`
|
|
|
|
|
Error string `gorm:"type:text" json:"error,omitempty"`
|
2026-05-25 16:38:46 +08:00
|
|
|
CreatedAt time.Time `json:"createdAt"`
|
|
|
|
|
UpdatedAt time.Time `json:"updatedAt,omitempty"`
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// TaskResponse 任务响应。
|
|
|
|
|
type TaskResponse struct {
|
|
|
|
|
ID string `json:"id"`
|
|
|
|
|
ProjectID string `json:"projectId"`
|
|
|
|
|
Prompt string `json:"prompt"`
|
|
|
|
|
AssetType string `json:"assetType"`
|
|
|
|
|
Status string `json:"status"`
|
|
|
|
|
Stage string `json:"stage,omitempty"`
|
|
|
|
|
Progress int `json:"progress"`
|
|
|
|
|
RetryCount int `json:"retryCount"`
|
|
|
|
|
Error string `json:"error,omitempty"`
|
|
|
|
|
CreatedAt string `json:"createdAt"`
|
|
|
|
|
UpdatedAt string `json:"updatedAt,omitempty"`
|
|
|
|
|
}
|