feat(gateway): 补齐桌面端高级媒体直连接口
ci / verify (pull_request) Successful in 15m34s
ci / verify (pull_request) Successful in 15m34s
新增图片矢量化、视频超分、每日用量、计价与任务隔离能力,并通过环境变量解析平台凭据。 已通过 Go 全量门禁、迁移检查、镜像构建以及 Vectorizer 五格式和 Topaz 3 秒视频真实 DEV 验收。
This commit is contained in:
@@ -659,6 +659,28 @@ func (s *Service) billingsWithResolvedPricingV2(
|
||||
resource = "image_edit"
|
||||
baseKey = "editBase"
|
||||
}
|
||||
if kind == "images.vectorize" {
|
||||
resource = "image_vectorize"
|
||||
unit = "conversion"
|
||||
baseKey = "vectorizeBase"
|
||||
}
|
||||
if kind == "videos.upscales" {
|
||||
resource = "video_enhance"
|
||||
unit = "5s_video"
|
||||
baseKey = "videoEnhanceBase"
|
||||
inputs := resolveVideoEnhancePricingInputs(body, response)
|
||||
price, priceErr := pricing.requiredPrice(resource, baseKey, "basePrice")
|
||||
if priceErr != nil {
|
||||
return nil, 0, resolvedPricing{}, priceErr
|
||||
}
|
||||
rawAmount, details := videoEnhanceAmount(pricing.Config, inputs, float64(count), price.Float64())
|
||||
rawAmount = math.Ceil(rawAmount*1e8) / 1e8
|
||||
amount, amountErr := fixedAmountFromAny(rawAmount * discount.Float64())
|
||||
if amountErr != nil {
|
||||
return nil, 0, resolvedPricing{}, pricing.calculationError(resource, amountErr)
|
||||
}
|
||||
return []any{buildLine(resource, unit, float64(count)*inputs.DurationUnits, amount, details)}, amount, pricing, nil
|
||||
}
|
||||
if kind == "videos.generations" {
|
||||
resource = "video"
|
||||
unit = "5s_video"
|
||||
|
||||
Reference in New Issue
Block a user