Documentation
¶
Overview ¶
Package taskmodel provides a minimal Task struct and status constants for async task providers. In LingRein, this is a GORM model backed by a database. In library mode, it's a plain struct.
Index ¶
Constants ¶
const ( TaskStatusQueued = "QUEUED" TaskStatusSubmitted = "SUBMITTED" TaskStatusInProgress = "IN_PROGRESS" TaskStatusSuccess = "SUCCESS" TaskStatusFailure = "FAILURE" )
Task status constants.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Task ¶
type Task struct {
TaskID string `json:"task_id"`
Status TaskStatus `json:"status"`
Model string `json:"model"`
Progress string `json:"progress"`
Result string `json:"result"`
Reason string `json:"reason,omitempty"`
Error string `json:"error,omitempty"`
// Library-mode extensions (stubs for LingRein compatibility).
Data json.RawMessage `json:"-"`
CreatedAt int64 `json:"-"`
UpdatedAt int64 `json:"-"`
FinishTime int64 `json:"-"`
Properties TaskProperties `json:"-"`
}
Task represents an async AI generation task.
func (*Task) GetResultURL ¶
GetResultURL returns the result URL for the task.
func (*Task) GetUpstreamTaskID ¶
GetUpstreamTaskID returns the upstream provider's task ID. In library mode this is the same as TaskID.
func (*Task) ToOpenAIVideo ¶
func (t *Task) ToOpenAIVideo() *dto.OpenAIVideo
ToOpenAIVideo converts the task to an OpenAIVideo response.
type TaskProperties ¶
type TaskProperties struct {
OriginModelName string
}
TaskProperties holds extra properties associated with a task. In LingRein this is a JSON column; in library mode it's a plain struct.
type TaskStatus ¶
type TaskStatus string
TaskStatus is the status of an async task.
func (TaskStatus) ToVideoStatus ¶
func (s TaskStatus) ToVideoStatus() string
ToVideoStatus converts a TaskStatus to an OpenAI video status string.