dto

package
v1.0.0-rc.32 Latest Latest
Warning

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

Go to latest
Published: Sep 4, 2026 License: AGPL-3.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PinRankToken      = 0
	PinRankOriginTask = 10
)
View Source
const TaskSuccessCode = "success"

Variables

This section is empty.

Functions

This section is empty.

Types

type ActionButton

type ActionButton struct {
	CustomId any `json:"customId"`
	Emoji    any `json:"emoji"`
	Label    any `json:"label"`
	Type     any `json:"type"`
	Style    any `json:"style"`
}

type ChannelConstraints

type ChannelConstraints struct {
	Pins    []ChannelPin
	Filters []ChannelFilter
}

func (*ChannelConstraints) AddFilter

func (cc *ChannelConstraints) AddFilter(f ChannelFilter)

func (*ChannelConstraints) AddPin

func (cc *ChannelConstraints) AddPin(p ChannelPin)

func (*ChannelConstraints) ResolvedPin

func (cc *ChannelConstraints) ResolvedPin() (ChannelPin, bool, []ChannelPin)

ResolvedPin returns the winning pin after priority resolution. Lowest Rank wins. Pins that name the same channel are merged (stricter RetryMode). overridden lists pins that lost to a different channel (for warn logging).

func (*ChannelConstraints) SuppressesRetry

func (cc *ChannelConstraints) SuppressesRetry() bool

type ChannelFilter

type ChannelFilter struct {
	Kind                   ChannelFilterKind
	RequestPath            string
	TaskPluginKey          string
	TaskPluginChannelTypes []int
}

type ChannelFilterKind

type ChannelFilterKind string
const (
	FilterRequestPath        ChannelFilterKind = "request_path"
	FilterTaskPluginIdentity ChannelFilterKind = "task_plugin_identity"
)

type ChannelPin

type ChannelPin struct {
	ChannelId int
	Source    ChannelPinSource
	Rank      int
	RetryMode PinRetryMode
}

type ChannelPinSource

type ChannelPinSource string
const (
	PinSourceToken      ChannelPinSource = "token"       // Rank 0, highest
	PinSourceOriginTask ChannelPinSource = "origin_task" // Rank 10
)

type FetchReq

type FetchReq struct {
	IDs []string `json:"ids"`
}

type GoAPIFetchResponseData

type GoAPIFetchResponseData struct {
	TaskID string              `json:"task_id"`
	Status string              `json:"status"`
	Input  string              `json:"input"`
	Clips  map[string]SunoSong `json:"clips"`
}

type GoAPITaskResponse

type GoAPITaskResponse[T any] struct {
	Code         int    `json:"code"`
	Message      string `json:"message"`
	Data         T      `json:"data"`
	ErrorMessage string `json:"error_message,omitempty"`
}

type GoAPITaskResponseData

type GoAPITaskResponseData struct {
	TaskID string `json:"task_id"`
}

type ImgUrls

type ImgUrls struct {
	Url string `json:"url"`
}

type MidjourneyDto

type MidjourneyDto struct {
	MjId        string      `json:"id"`
	Action      string      `json:"action"`
	CustomId    string      `json:"customId"`
	BotType     string      `json:"botType"`
	Prompt      string      `json:"prompt"`
	PromptEn    string      `json:"promptEn"`
	Description string      `json:"description"`
	State       string      `json:"state"`
	SubmitTime  int64       `json:"submitTime"`
	StartTime   int64       `json:"startTime"`
	FinishTime  int64       `json:"finishTime"`
	ImageUrl    string      `json:"imageUrl"`
	VideoUrl    string      `json:"videoUrl"`
	VideoUrls   []ImgUrls   `json:"videoUrls"`
	Status      string      `json:"status"`
	Progress    string      `json:"progress"`
	FailReason  string      `json:"failReason"`
	Buttons     any         `json:"buttons"`
	MaskBase64  string      `json:"maskBase64"`
	Properties  *Properties `json:"properties"`
}

type MidjourneyRequest

type MidjourneyRequest struct {
	Prompt      string   `json:"prompt"`
	CustomId    string   `json:"customId"`
	BotType     string   `json:"botType"`
	NotifyHook  string   `json:"notifyHook"`
	Action      string   `json:"action"`
	Index       int      `json:"index"`
	State       string   `json:"state"`
	TaskId      string   `json:"taskId"`
	Base64Array []string `json:"base64Array"`
	Content     string   `json:"content"`
	MaskBase64  string   `json:"maskBase64"`
}

type MidjourneyResponse

type MidjourneyResponse struct {
	Code        int         `json:"code"`
	Description string      `json:"description"`
	Properties  interface{} `json:"properties"`
	Result      string      `json:"result"`
}

type MidjourneyResponseWithStatusCode

type MidjourneyResponseWithStatusCode struct {
	StatusCode int `json:"statusCode"`
	Response   MidjourneyResponse
}

type MidjourneyStatus

type MidjourneyStatus struct {
	Status int `json:"status"`
}

type MidjourneyUploadResponse

type MidjourneyUploadResponse struct {
	Code        int      `json:"code"`
	Description string   `json:"description"`
	Result      []string `json:"result"`
}

type MidjourneyWithoutStatus

type MidjourneyWithoutStatus struct {
	Id          int    `json:"id"`
	Code        int    `json:"code"`
	UserId      int    `json:"user_id" gorm:"index"`
	Action      string `json:"action"`
	MjId        string `json:"mj_id" gorm:"index"`
	Prompt      string `json:"prompt"`
	PromptEn    string `json:"prompt_en"`
	Description string `json:"description"`
	State       string `json:"state"`
	SubmitTime  int64  `json:"submit_time"`
	StartTime   int64  `json:"start_time"`
	FinishTime  int64  `json:"finish_time"`
	ImageUrl    string `json:"image_url"`
	Progress    string `json:"progress"`
	FailReason  string `json:"fail_reason"`
	ChannelId   int    `json:"channel_id"`
}

type PinRetryMode

type PinRetryMode int
const (
	PinRetrySameChannel PinRetryMode = iota
	PinRetrySingleAttempt
)

func (PinRetryMode) Stricter

func (m PinRetryMode) Stricter(other PinRetryMode) PinRetryMode

type PluginResponsesContent

type PluginResponsesContent struct {
	ID          string `json:"id"`
	Type        string `json:"type"`
	Text        string `json:"text"`
	Annotations []any  `json:"annotations"`
	Logprobs    []any  `json:"logprobs"`
}

type PluginResponsesError

type PluginResponsesError struct {
	Code    string `json:"code"`
	Message string `json:"message"`
}

type PluginResponsesIncompleteDetail

type PluginResponsesIncompleteDetail struct {
	Reason string `json:"reason"`
}

type PluginResponsesInputTokenDetails

type PluginResponsesInputTokenDetails struct {
	CachedTokens int `json:"cached_tokens"`
}

type PluginResponsesOutput

type PluginResponsesOutput struct {
	ID      string                   `json:"id"`
	Type    string                   `json:"type"`
	Status  string                   `json:"status"`
	Role    string                   `json:"role"`
	Content []PluginResponsesContent `json:"content"`
}

type PluginResponsesOutputTokenDetails

type PluginResponsesOutputTokenDetails struct {
	ReasoningTokens int `json:"reasoning_tokens"`
}

type PluginResponsesResponse

type PluginResponsesResponse struct {
	ID                string                           `json:"id"`
	Object            string                           `json:"object"`
	CreatedAt         int64                            `json:"created_at"`
	Status            string                           `json:"status"`
	Error             *PluginResponsesError            `json:"error"`
	IncompleteDetails *PluginResponsesIncompleteDetail `json:"incomplete_details"`
	Instructions      any                              `json:"instructions"`
	Model             string                           `json:"model"`
	Output            []PluginResponsesOutput          `json:"output"`
	ParallelToolCalls bool                             `json:"parallel_tool_calls"`
	Temperature       float64                          `json:"temperature"`
	ToolChoice        any                              `json:"tool_choice"`
	Tools             []any                            `json:"tools"`
	TopP              float64                          `json:"top_p"`
	Metadata          map[string]string                `json:"metadata"`
	Usage             *PluginResponsesUsage            `json:"usage"`
}

PluginResponsesResponse is the host-owned Responses facade used for stream snapshots and sanitized terminal failures. Non-stream success objects may retain additional validated plugin fields, but identifiers, lifecycle state, and retrieval metadata are always populated by the host.

type PluginResponsesStreamEvent

type PluginResponsesStreamEvent struct {
	Type           string                   `json:"type"`
	SequenceNumber int                      `json:"sequence_number"`
	Response       *PluginResponsesResponse `json:"response,omitempty"`
	OutputIndex    *int                     `json:"output_index,omitempty"`
	ContentIndex   *int                     `json:"content_index,omitempty"`
	ItemID         string                   `json:"item_id,omitempty"`
	Item           *PluginResponsesOutput   `json:"item,omitempty"`
	Part           *PluginResponsesContent  `json:"part,omitempty"`
	Delta          *string                  `json:"delta,omitempty"`
	Text           *string                  `json:"text,omitempty"`
	Logprobs       *[]any                   `json:"logprobs,omitempty"`
}

PluginResponsesStreamEvent contains the exact event-specific fields used by the host Responses state machine. Pointer fields preserve required empty strings and arrays on delta/done events while omitting unrelated fields.

type PluginResponsesUsage

type PluginResponsesUsage struct {
	InputTokens         int                               `json:"input_tokens"`
	InputTokensDetails  PluginResponsesInputTokenDetails  `json:"input_tokens_details"`
	OutputTokens        int                               `json:"output_tokens"`
	OutputTokensDetails PluginResponsesOutputTokenDetails `json:"output_tokens_details"`
	TotalTokens         int                               `json:"total_tokens"`
}

type Properties

type Properties struct {
	FinalPrompt   string `json:"finalPrompt"`
	FinalZhPrompt string `json:"finalZhPrompt"`
}

type SunoDataResponse

type SunoDataResponse struct {
	TaskID     string          `json:"task_id" gorm:"type:varchar(50);index"`
	Action     string          `json:"action" gorm:"type:varchar(40);index"` // 任务类型, song, lyrics, description-mode
	Status     string          `json:"status" gorm:"type:varchar(20);index"` // 任务状态, submitted, queueing, processing, success, failed
	FailReason string          `json:"fail_reason"`
	SubmitTime int64           `json:"submit_time" gorm:"index"`
	StartTime  int64           `json:"start_time" gorm:"index"`
	FinishTime int64           `json:"finish_time" gorm:"index"`
	Data       json.RawMessage `json:"data" gorm:"type:json"`
}

type SunoGoAPISubmitReq

type SunoGoAPISubmitReq struct {
	CustomMode bool `json:"custom_mode"`

	Input SunoGoAPISubmitReqInput `json:"input"`

	NotifyHook string `json:"notify_hook,omitempty"`
}

type SunoGoAPISubmitReqInput

type SunoGoAPISubmitReqInput struct {
	GptDescriptionPrompt string  `json:"gpt_description_prompt"`
	Prompt               string  `json:"prompt"`
	Mv                   string  `json:"mv"`
	Title                string  `json:"title"`
	Tags                 string  `json:"tags"`
	ContinueAt           float64 `json:"continue_at"`
	TaskID               string  `json:"task_id"`
	ContinueClipId       string  `json:"continue_clip_id"`
	MakeInstrumental     bool    `json:"make_instrumental"`
}

type SunoLyrics

type SunoLyrics struct {
	ID     string `json:"id"`
	Status string `json:"status"`
	Title  string `json:"title"`
	Text   string `json:"text"`
}

type SunoMetadata

type SunoMetadata struct {
	Tags                 string      `json:"tags"`
	Prompt               string      `json:"prompt"`
	GPTDescriptionPrompt interface{} `json:"gpt_description_prompt"`
	AudioPromptID        interface{} `json:"audio_prompt_id"`
	Duration             interface{} `json:"duration"`
	ErrorType            interface{} `json:"error_type"`
	ErrorMessage         interface{} `json:"error_message"`
}

type SunoSong

type SunoSong struct {
	ID                string       `json:"id"`
	VideoURL          string       `json:"video_url"`
	AudioURL          string       `json:"audio_url"`
	ImageURL          string       `json:"image_url"`
	ImageLargeURL     string       `json:"image_large_url"`
	MajorModelVersion string       `json:"major_model_version"`
	ModelName         string       `json:"model_name"`
	Status            string       `json:"status"`
	Title             string       `json:"title"`
	Text              string       `json:"text"`
	Metadata          SunoMetadata `json:"metadata"`
}

type SunoSubmitReq

type SunoSubmitReq struct {
	GptDescriptionPrompt string  `json:"gpt_description_prompt,omitempty"`
	Prompt               string  `json:"prompt,omitempty"`
	Mv                   string  `json:"mv,omitempty"`
	Title                string  `json:"title,omitempty"`
	Tags                 string  `json:"tags,omitempty"`
	ContinueAt           float64 `json:"continue_at,omitempty"`
	TaskID               string  `json:"task_id,omitempty"`
	ContinueClipId       string  `json:"continue_clip_id,omitempty"`
	MakeInstrumental     bool    `json:"make_instrumental"`
}

type SwapFaceRequest

type SwapFaceRequest struct {
	SourceBase64 string `json:"sourceBase64"`
	TargetBase64 string `json:"targetBase64"`
}

type TaskAdminInfo

type TaskAdminInfo struct {
	RequestID   string          `json:"request_id,omitempty"`
	RequestPath string          `json:"request_path,omitempty"`
	TaskPlugin  *TaskPluginInfo `json:"task_plugin,omitempty"`
}

type TaskData

type TaskData interface {
	SunoDataResponse | []SunoDataResponse | string | any
}

type TaskDto

type TaskDto struct {
	ID                   int64           `json:"id"`
	CreatedAt            int64           `json:"created_at"`
	UpdatedAt            int64           `json:"updated_at"`
	TaskID               string          `json:"task_id"`
	Platform             string          `json:"platform"`
	UserId               int             `json:"user_id"`
	Group                string          `json:"group"`
	ChannelId            int             `json:"channel_id"`
	Quota                int             `json:"quota"`
	Action               string          `json:"action"`
	Status               string          `json:"status"`
	FailReason           string          `json:"fail_reason"`
	ResultURL            string          `json:"result_url,omitempty"` // 任务结果 URL(视频地址等)
	LegacyVideoAvailable bool            `json:"legacy_video_available,omitempty"`
	SubmitTime           int64           `json:"submit_time"`
	StartTime            int64           `json:"start_time"`
	FinishTime           int64           `json:"finish_time"`
	Progress             string          `json:"progress"`
	Properties           any             `json:"properties"`
	Username             string          `json:"username,omitempty"`
	Data                 json.RawMessage `json:"data"`
	AdminInfo            *TaskAdminInfo  `json:"admin_info,omitempty"`
	RootInfo             *TaskRootInfo   `json:"root_info,omitempty"`
}

type TaskError

type TaskError struct {
	Code       string `json:"code"`
	Message    string `json:"message"`
	Data       any    `json:"data"`
	StatusCode int    `json:"-"`
	LocalError bool   `json:"-"`
	Error      error  `json:"-"`
}

type TaskPluginAuthorInfo

type TaskPluginAuthorInfo struct {
	Name string `json:"name"`
	URL  string `json:"url,omitempty"`
}

type TaskPluginError

type TaskPluginError struct {
	Code       string `json:"code"`
	Message    string `json:"message"`
	HTTPStatus int    `json:"httpStatus"`
	Retryable  bool   `json:"retryable"`
}

type TaskPluginInfo

type TaskPluginInfo struct {
	Key     string                `json:"key"`
	Name    string                `json:"name"`
	Version string                `json:"version,omitempty"`
	Author  *TaskPluginAuthorInfo `json:"author,omitempty"`
}

type TaskPluginRuntimeInfo

type TaskPluginRuntimeInfo struct {
	Key        string `json:"key"`
	Version    string `json:"version"`
	APIVersion int    `json:"api_version"`
	Generation uint64 `json:"generation"`
}

type TaskResponse

type TaskResponse[T TaskData] struct {
	Code    string `json:"code"`
	Message string `json:"message"`
	Data    T      `json:"data"`
}

func (*TaskResponse[T]) IsSuccess

func (t *TaskResponse[T]) IsSuccess() bool

type TaskRootInfo

type TaskRootInfo struct {
	TaskPlugin     *TaskPluginRuntimeInfo `json:"task_plugin,omitempty"`
	UpstreamTaskID string                 `json:"upstream_task_id,omitempty"`
	NodeName       string                 `json:"node_name,omitempty"`
}

type TaskView

type TaskView struct {
	TaskID     string `json:"task_id"`
	Platform   string `json:"platform"`
	Status     string `json:"status"`
	Progress   string `json:"progress"`
	FailReason string `json:"fail_reason"`
	CreatedAt  int64  `json:"created_at"`
	UpdatedAt  int64  `json:"updated_at,omitempty"`
	FinishedAt int64  `json:"finished_at,omitempty"`
	Data       any    `json:"data,omitempty"`
}

TaskView is the only persisted-task shape exposed to JavaScript plugins. It deliberately excludes ownership, channel, quota, properties, and private upstream identifiers.

type VideoRequest

type VideoRequest struct {
	Model  string `json:"model,omitempty" example:"kling-v1"`  // Model/style ID
	Prompt string `json:"prompt,omitempty" example:"宇航员站起身走了"` // Text prompt
	Image  string ``                                           // Image input (URL/Base64)
	/* 172-byte string literal not displayed */
	Duration       float64        `json:"duration" example:"5.0"`                  // Video duration (seconds)
	Width          int            `json:"width" example:"512"`                     // Video width
	Height         int            `json:"height" example:"512"`                    // Video height
	Fps            int            `json:"fps,omitempty" example:"30"`              // Video frame rate
	Seed           int            `json:"seed,omitempty" example:"20231234"`       // Random seed
	N              int            `json:"n,omitempty" example:"1"`                 // Number of videos to generate
	ResponseFormat string         `json:"response_format,omitempty" example:"url"` // Response format
	User           string         `json:"user,omitempty" example:"user-1234"`      // User identifier
	Metadata       map[string]any `json:"metadata,omitempty"`                      // Vendor-specific/custom params (e.g. negative_prompt, style, quality_level, etc.)
}

type VideoResponse

type VideoResponse struct {
	TaskId string `json:"task_id"`
	Status string `json:"status"`
}

VideoResponse 视频生成提交任务后的响应

type VideoTaskError

type VideoTaskError struct {
	Code    int    `json:"code"`
	Message string `json:"message"`
}

VideoTaskError 视频任务错误信息

type VideoTaskMetadata

type VideoTaskMetadata struct {
	Duration float64 `json:"duration" example:"5.0"`  // 实际生成的视频时长
	Fps      int     `json:"fps" example:"30"`        // 实际帧率
	Width    int     `json:"width" example:"512"`     // 实际宽度
	Height   int     `json:"height" example:"512"`    // 实际高度
	Seed     int     `json:"seed" example:"20231234"` // 使用的随机种子
}

VideoTaskMetadata 视频任务元数据

type VideoTaskResponse

type VideoTaskResponse struct {
	TaskId   string             `json:"task_id" example:"abcd1234efgh"` // 任务ID
	Status   string             `json:"status" example:"succeeded"`     // 任务状态
	Url      string             `json:"url,omitempty"`                  // 视频资源URL(成功时)
	Format   string             `json:"format,omitempty" example:"mp4"` // 视频格式
	Metadata *VideoTaskMetadata `json:"metadata,omitempty"`             // 结果元数据
	Error    *VideoTaskError    `json:"error,omitempty"`                // 错误信息(失败时)
}

VideoTaskResponse 查询视频生成任务状态的响应

Jump to

Keyboard shortcuts

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