fix(sora): 修复流式重写与计费问题

This commit is contained in:
yangjianbo
2026-01-31 21:46:28 +08:00
parent 618a614cbf
commit 78d0ca3775
19 changed files with 325 additions and 210 deletions

View File

@@ -3465,7 +3465,7 @@ func (s *GatewayService) RecordUsage(ctx context.Context, input *RecordUsageInpu
var cost *CostBreakdown
// 根据请求类型选择计费方式
if result.MediaType == "image" || result.MediaType == "video" || result.MediaType == "prompt" {
if result.MediaType == "image" || result.MediaType == "video" {
var soraConfig *SoraPriceConfig
if apiKey.Group != nil {
soraConfig = &SoraPriceConfig{
@@ -3480,6 +3480,8 @@ func (s *GatewayService) RecordUsage(ctx context.Context, input *RecordUsageInpu
} else {
cost = s.billingService.CalculateSoraVideoCost(result.Model, soraConfig, multiplier)
}
} else if result.MediaType == "prompt" {
cost = &CostBreakdown{}
} else if result.ImageCount > 0 {
// 图片生成计费
var groupConfig *ImagePriceConfig