Help us shape the future of Go! Take the 2026 Go Developer Survey

relay

package
v0.13.2 Latest Latest
Warning

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

Go to latest
Published: Apr 27, 2026 License: AGPL-3.0 Imports: 72 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AudioHelper

func AudioHelper(c *gin.Context, info *relaycommon.RelayInfo) (newAPIError *types.NewAPIError)

func ClaudeHelper

func ClaudeHelper(c *gin.Context, info *relaycommon.RelayInfo) (newAPIError *types.NewAPIError)

func EmbeddingHelper

func EmbeddingHelper(c *gin.Context, info *relaycommon.RelayInfo) (newAPIError *types.NewAPIError)

func GeminiEmbeddingHandler

func GeminiEmbeddingHandler(c *gin.Context, info *relaycommon.RelayInfo) (newAPIError *types.NewAPIError)

func GeminiHelper

func GeminiHelper(c *gin.Context, info *relaycommon.RelayInfo) (newAPIError *types.NewAPIError)

func GetAdaptor

func GetAdaptor(apiType int) channel.Adaptor

func GetTaskAdaptor

func GetTaskAdaptor(platform constant.TaskPlatform) channel.TaskAdaptor

func GetTaskPlatform

func GetTaskPlatform(c *gin.Context) constant.TaskPlatform

func ImageHelper

func ImageHelper(c *gin.Context, info *relaycommon.RelayInfo) (newAPIError *types.NewAPIError)

func RelayMidjourneyImage

func RelayMidjourneyImage(c *gin.Context)

func RelayMidjourneyNotify

func RelayMidjourneyNotify(c *gin.Context) *dto.MidjourneyResponse

func RelayMidjourneySubmit

func RelayMidjourneySubmit(c *gin.Context, relayInfo *relaycommon.RelayInfo) *dto.MidjourneyResponse

func RelayMidjourneyTask

func RelayMidjourneyTask(c *gin.Context, relayMode int) *dto.MidjourneyResponse

func RelayMidjourneyTaskImageSeed

func RelayMidjourneyTaskImageSeed(c *gin.Context) *dto.MidjourneyResponse

func RelaySwapFace

func RelaySwapFace(c *gin.Context, info *relaycommon.RelayInfo) *dto.MidjourneyResponse

func RelayTaskFetch

func RelayTaskFetch(c *gin.Context, relayMode int) (taskResp *dto.TaskError)

func RerankHelper

func RerankHelper(c *gin.Context, info *relaycommon.RelayInfo) (newAPIError *types.NewAPIError)

func ResolveOriginTask added in v0.11.0

func ResolveOriginTask(c *gin.Context, info *relaycommon.RelayInfo) *dto.TaskError

ResolveOriginTask 处理基于已有任务的提交(remix / continuation): 查找原始任务、从中提取模型名称、将渠道锁定到原始任务的渠道 (通过 info.LockedChannel,重试时复用同一渠道并轮换 key), 以及提取 OtherRatios(时长、分辨率)。 该函数在控制器的重试循环之前调用一次,其结果通过 info 字段和上下文持久化。

func ResponsesHelper

func ResponsesHelper(c *gin.Context, info *relaycommon.RelayInfo) (newAPIError *types.NewAPIError)

func TaskModel2Dto

func TaskModel2Dto(task *model.Task) *dto.TaskDto

func TextHelper

func TextHelper(c *gin.Context, info *relaycommon.RelayInfo) (newAPIError *types.NewAPIError)

func WssHelper

func WssHelper(c *gin.Context, info *relaycommon.RelayInfo) (newAPIError *types.NewAPIError)

Types

type TaskSubmitResult added in v0.11.0

type TaskSubmitResult struct {
	UpstreamTaskID string
	TaskData       []byte
	Platform       constant.TaskPlatform
	Quota          int
}

func RelayTaskSubmit

func RelayTaskSubmit(c *gin.Context, info *relaycommon.RelayInfo) (*TaskSubmitResult, *dto.TaskError)

RelayTaskSubmit 完成 task 提交的全部流程(每次尝试调用一次): 刷新渠道元数据 → 确定 platform/adaptor → 验证请求 → 估算计费(EstimateBilling) → 计算价格 → 预扣费(仅首次)→ 构建/发送/解析上游请求 → 提交后计费调整(AdjustBillingOnSubmit)。 控制器负责 defer Refund 和成功后 Settle。

Jump to

Keyboard shortcuts

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