Documentation
¶
Index ¶
- Constants
- func BuildConfiguredTaskURL(baseURL string, path string, values map[string]string) string
- func BuildProxyURL(taskID string) string
- func BuildTaskQueryURL(baseURL string, body map[string]any, fallback string) string
- func BuildTaskSubmitURL(info *relaycommon.RelayInfo, fallback string) string
- func ConfiguredTaskErrorWrapper(err error, code string, statusCode int) *dto.TaskError
- func ConvertConfiguredTaskToOpenAIVideo(originTask *model.Task) ([]byte, bool, error)
- func DecodeLocalTaskID(id string) (string, error)
- func DefaultInt(val, fallback int) int
- func DefaultString(val, fallback string) string
- func EncodeLocalTaskID(name string) string
- func ExtractConfiguredResultURL(data []byte, paths []string) string
- func HasTaskProtocolConfig(settings dto.ChannelOtherSettings) bool
- func IsVideoTaskChannelType(channelType int) bool
- func MapConfiguredTaskStatus(status string, cfg dto.TaskProtocolConfig) string
- func MissingConfiguredTaskIDError() *dto.TaskError
- func NormalizeConfiguredProgress(progress string, status string) string
- func NormalizeInternalTaskStatus(status string) string
- func NormalizeTaskProtocolConfig(input *dto.TaskProtocolConfig) dto.TaskProtocolConfig
- func ParseConfiguredTaskResult(respBody []byte, settings dto.ChannelOtherSettings) (*relaycommon.TaskInfo, bool, error)
- func StringFromGJSONPath(data []byte, path string) string
- func StripTaskProtocolConfig(body map[string]any) map[string]any
- func TaskProtocolConfigFromTask(task *model.Task) (dto.TaskProtocolConfig, bool)
- func TimestampFromGJSONPath(data []byte, path string) int64
- func TryHandleConfiguredSubmitResponse(c *gin.Context, responseBody []byte, info *relaycommon.RelayInfo) (string, bool, *dto.TaskError)
- func UnmarshalMetadata(metadata map[string]any, target any) error
- func UseConfiguredTaskProtocol(settings dto.ChannelOtherSettings) bool
- func ValidateTaskProtocolSettings(otherSettings string) error
- func WithTaskProtocolConfig(body map[string]any, settings dto.ChannelOtherSettings) map[string]any
- type BaseBilling
Constants ¶
const ( ProgressSubmitted = "10%" ProgressQueued = "20%" ProgressInProgress = "30%" ProgressComplete = "100%" )
Status-to-progress mapping constants for polling updates.
const ( TaskProtocolGenericVideo = "generic_video_task" TaskProtocolLegacySeedanceMedia = "seedance_official_media" )
Variables ¶
This section is empty.
Functions ¶
func BuildConfiguredTaskURL ¶
func BuildProxyURL ¶
BuildProxyURL constructs the video proxy URL using the public task ID. e.g., "https://your-server.com/v1/videos/task_xxxx/content"
func BuildTaskQueryURL ¶
func BuildTaskSubmitURL ¶
func BuildTaskSubmitURL(info *relaycommon.RelayInfo, fallback string) string
func DecodeLocalTaskID ¶
DecodeLocalTaskID decodes a base64-encoded upstream operation name.
func DefaultInt ¶
DefaultInt returns val if non-zero, otherwise fallback.
func DefaultString ¶
DefaultString returns val if non-empty, otherwise fallback.
func EncodeLocalTaskID ¶
EncodeLocalTaskID encodes an upstream operation name to a URL-safe base64 string. Used by Gemini/Vertex to store upstream names as task IDs.
func HasTaskProtocolConfig ¶
func HasTaskProtocolConfig(settings dto.ChannelOtherSettings) bool
func IsVideoTaskChannelType ¶
func MapConfiguredTaskStatus ¶
func MapConfiguredTaskStatus(status string, cfg dto.TaskProtocolConfig) string
func NormalizeTaskProtocolConfig ¶
func NormalizeTaskProtocolConfig(input *dto.TaskProtocolConfig) dto.TaskProtocolConfig
func ParseConfiguredTaskResult ¶
func ParseConfiguredTaskResult(respBody []byte, settings dto.ChannelOtherSettings) (*relaycommon.TaskInfo, bool, error)
func StringFromGJSONPath ¶
func TaskProtocolConfigFromTask ¶
func TaskProtocolConfigFromTask(task *model.Task) (dto.TaskProtocolConfig, bool)
func TimestampFromGJSONPath ¶
func UnmarshalMetadata ¶
UnmarshalMetadata converts a map[string]any metadata to a typed struct via JSON round-trip. This replaces the repeated pattern: json.Marshal(metadata) → json.Unmarshal(bytes, &target).
func UseConfiguredTaskProtocol ¶
func UseConfiguredTaskProtocol(settings dto.ChannelOtherSettings) bool
func ValidateTaskProtocolSettings ¶
ValidateTaskProtocolSettings 校验渠道 settings JSON 中的任务协议配置。 仅在配置存在时校验,不解析失败的 JSON 交由渠道其他校验处理。
func WithTaskProtocolConfig ¶
Types ¶
type BaseBilling ¶
type BaseBilling struct{}
func (BaseBilling) AdjustBillingOnComplete ¶
func (BaseBilling) AdjustBillingOnComplete(_ *model.Task, _ *relaycommon.TaskInfo) int
AdjustBillingOnComplete returns 0 (keep pre-charged amount).
func (BaseBilling) AdjustBillingOnSubmit ¶
func (BaseBilling) AdjustBillingOnSubmit(_ *relaycommon.RelayInfo, _ []byte) map[string]float64
AdjustBillingOnSubmit returns nil (no submit-time adjustment).
func (BaseBilling) EstimateBilling ¶
func (BaseBilling) EstimateBilling(_ *gin.Context, _ *relaycommon.RelayInfo) map[string]float64
EstimateBilling returns nil (no extra ratios; use base model price).