test(admin,service): 修复代理质量与计费单测口径

This commit is contained in:
yangjianbo
2026-02-19 21:39:31 +08:00
parent b341810e60
commit 48dc011b2a
2 changed files with 6 additions and 6 deletions

View File

@@ -399,8 +399,8 @@ func TestCalculateCost_SupportsCacheBreakdown(t *testing.T) {
InputPricePerToken: 3e-6,
OutputPricePerToken: 15e-6,
SupportsCacheBreakdown: true,
CacheCreation5mPrice: 4.0, // per million tokens
CacheCreation1hPrice: 5.0, // per million tokens
CacheCreation5mPrice: 4e-6, // per token
CacheCreation1hPrice: 5e-6, // per token
},
},
}
@@ -414,8 +414,8 @@ func TestCalculateCost_SupportsCacheBreakdown(t *testing.T) {
cost, err := svc.CalculateCost("claude-sonnet-4", tokens, 1.0)
require.NoError(t, err)
expected5m := float64(100000) / 1_000_000 * 4.0
expected1h := float64(50000) / 1_000_000 * 5.0
expected5m := float64(tokens.CacheCreation5mTokens) * 4e-6
expected1h := float64(tokens.CacheCreation1hTokens) * 5e-6
require.InDelta(t, expected5m+expected1h, cost.CacheCreationCost, 1e-10)
}