diff --git a/common/util/billing.go b/common/util/billing.go index 418893b..2ed6881 100644 --- a/common/util/billing.go +++ b/common/util/billing.go @@ -30,12 +30,9 @@ func CalculateBilling(config map[string]any, billingData map[string]any) map[str func calculateInferenceTierBilling(config map[string]any, data map[string]any) map[string]any { promptTokens := gconv.Int64(data["prompt_tokens"]) - fmt.Printf("calculateInferenceTierBilling promptTokens=%v\n", promptTokens) completionTokens := gconv.Int64(data["completion_tokens"]) - fmt.Printf("calculateInferenceTierBilling completionTokens=%v\n", completionTokens) hasAudio := gconv.Bool(data["has_audio"]) inputK := promptTokens / 1000 - fmt.Printf("calculateInferenceTierBilling inputK=%v\n", inputK) tiers := config["pricing"].(map[string]any)["tiers"].([]any) var matched map[string]any for _, t := range tiers { @@ -55,13 +52,10 @@ func calculateInferenceTierBilling(config map[string]any, data map[string]any) m } else { inputPrice = gconv.Float64(matched["input_price"]) } - fmt.Printf("calculateInferenceTierBilling inputPrice=%v\n", inputPrice) outputPrice := gconv.Float64(matched["output_price"]) - fmt.Printf("calculateInferenceTierBilling outputPrice=%v\n", outputPrice) inputCost := float64(promptTokens) * inputPrice / 1000000 outputCost := float64(completionTokens) * outputPrice / 1000000 - fmt.Printf("calculateBilling inputCost=%v, outputCost=%v\n", inputCost, outputCost) // 推理模型 return map[string]any{ "model_name": data["model_name"], diff --git a/service/task/worker.go b/service/task/worker.go index 0ad44d2..5f466c8 100644 --- a/service/task/worker.go +++ b/service/task/worker.go @@ -125,9 +125,7 @@ func (w *asyncWorker) handleOne(ctx context.Context, task *entity.ModelGatewayTa if billingResult != nil { task.BillingData[0] = billingResult totalFee := gconv.Float64(billingResult["total_fee"]) - fmt.Printf("[handleOne] 计费处理 totalFee1=%f", totalFee) if totalFee > 0 { - fmt.Printf("[handleOne] 计费处理 totalFee2=%f", totalFee) _ = gateway.DeductBalance(util.AsyncCtx(ctx), model.TenantId, -totalFee) } } @@ -338,9 +336,7 @@ func (w *asyncWorker) parseAndRetry(ctx context.Context, body map[string]any, mo if billingResult != nil { task.BillingData = append(task.BillingData, billingResult) totalFee := gconv.Float64(billingResult["total_fee"]) - fmt.Println("totalFee==================", totalFee) if totalFee > 0 { - fmt.Println("deduct balance================", totalFee) _ = gateway.DeductBalance(util.AsyncCtx(ctx), task.TenantId, -totalFee) } }