tasks

package
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: Jan 27, 2025 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const TaskTypeGenerateName = "task:generate"

Variables

This section is empty.

Functions

func CreateGenerateTask

func CreateGenerateTask(req GenerateRequest) (*asynq.Task, error)

func CreateGenerateTaskHandler

func CreateGenerateTaskHandler(cfg *config.Config, reg *registry.PluginRegistry) func(context.Context, *asynq.Task) error

func GenerateTaskId

func GenerateTaskId() string

Types

type GenerateRequest

type GenerateRequest struct {
	Prompt string `json:"prompt"`
	Model  string `json:"model,omitempty"`
	Style  string `json:"style,omitempty"`
}

type GenerateResponse

type GenerateResponse struct {
	Task   string `json:"task"`
	State  string `json:"state"`
	Pool   string `json:"pool"`
	Result any    `json:"result,omitempty"`
}

func CreateGenerateResponse

func CreateGenerateResponse(info *asynq.TaskInfo) (*GenerateResponse, error)

type GenerateResult

type GenerateResult struct {
	Text     string  `json:"text"`
	Model    string  `json:"model,omitempty"`
	Style    string  `json:"style,omitempty"`
	Duration float64 `json:"duration,omitempty"`
}

Jump to

Keyboard shortcuts

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