From b9dff27e33a7570341d6d90d2a0e6c62884b4239 Mon Sep 17 00:00:00 2001 From: qhd <1766646056@qq.com> Date: Sat, 4 Jul 2026 20:05:52 +0800 Subject: [PATCH] =?UTF-8?q?chore:=20=E7=A7=BB=E9=99=A4=E8=AE=A1=E8=B4=B9?= =?UTF-8?q?=E7=9B=B8=E5=85=B3=E8=B0=83=E8=AF=95=E6=89=93=E5=8D=B0=E6=97=A5?= =?UTF-8?q?=E5=BF=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- common/util/billing.go | 6 ------ service/task/worker.go | 4 ---- 2 files changed, 10 deletions(-) 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) } }