Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions service/app/core/consume_strategy.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,8 @@ def calculate(self, context: ConsumptionContext) -> ConsumptionResult:
token_cost = context.input_tokens * self.INPUT_TOKEN_RATE + context.output_tokens * self.OUTPUT_TOKEN_RATE

# Tier rate multiplies ALL costs (including tool costs)
base_amount = self.BASE_COST + token_cost + context.tool_costs
final_amount = int(base_amount * tier_rate)
base_amount = self.BASE_COST + token_cost
final_amount = int(base_amount * tier_rate) + context.tool_costs
Comment on lines 102 to +104
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

issue: 行内注释不再与工具成本的最新计算方式一致。

现在代码将 context.tool_costs 排除在层级乘数之外,但行内注释却说明所有成本都会被乘以该系数。请更新注释以匹配当前行为(工具成本是在应用 tier_rate 之后再相加),或者如果工具成本本来就应该随 tier_rate 一起缩放,请恢复为之前的计算方式,使它们在乘数之前就被包含在 base_amount 中。

Original comment in English

issue: The inline comment no longer matches the updated calculation for tool costs.

The code now excludes context.tool_costs from the tier multiplier while the inline comment says all costs are multiplied. Please either update the comment to match the current behavior (tool costs are added after applying tier_rate) or, if tool costs are meant to scale with tier_rate, revert the calculation so they are included in base_amount before the multiplier.


return ConsumptionResult(
amount=final_amount,
Expand Down
Loading