taskmodel

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 23, 2026 License: MIT Imports: 2 Imported by: 0

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

View Source
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

func (t *Task) GetResultURL() string

GetResultURL returns the result URL for the task.

func (*Task) GetUpstreamTaskID

func (t *Task) GetUpstreamTaskID() string

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL