refactor: remove superseded dead code (#5916)

This commit is contained in:
SaladDay
2026-07-30 10:32:10 -04:00
committed by GitHub
parent c0ff89b9b2
commit 3c1154bed9
34 changed files with 8 additions and 3166 deletions
-27
View File
@@ -112,16 +112,6 @@ impl CostCalculator {
}
}
/// 尝试计算成本,如果模型未知则返回 None
#[allow(dead_code)]
pub fn try_calculate(
usage: &TokenUsage,
pricing: Option<&ModelPricing>,
cost_multiplier: Decimal,
) -> Option<CostBreakdown> {
pricing.map(|p| Self::calculate(usage, p, cost_multiplier))
}
pub fn try_calculate_for_app(
app_type: &str,
usage: &TokenUsage,
@@ -253,23 +243,6 @@ mod tests {
assert_eq!(cost.total_cost, Decimal::from_str("0.0045").unwrap());
}
#[test]
fn test_unknown_model_handling() {
let usage = TokenUsage {
input_tokens: 1000,
output_tokens: 500,
cache_read_tokens: 0,
cache_creation_tokens: 0,
model: None,
message_id: None,
};
let multiplier = Decimal::from_str("1.0").unwrap();
let cost = CostCalculator::try_calculate(&usage, None, multiplier);
assert!(cost.is_none());
}
#[test]
fn test_decimal_precision() {
let usage = TokenUsage {