Skip to content

Conversation

@feitianbubu
Copy link
Contributor

@feitianbubu feitianbubu commented Jan 24, 2026

任务预扣费默认取后台设置的请求预扣费额度

Summary by CodeRabbit

Release Notes

  • Bug Fixes
    • Refined fallback pricing calculation for relay tasks to dynamically compute prices based on quota metrics instead of using fixed default values.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 24, 2026

Walkthrough

A single line modification in the RelayTaskSubmit function changes the fallback default price calculation. When a model lacks a default price entry, the modelPrice is now computed from PreConsumedQuota divided by QuotaPerUnit instead of using a hard-coded value of 0.1.

Changes

Cohort / File(s) Summary
Price Calculation Fallback
relay/relay_task.go
Modified fallback default price logic in RelayTaskSubmit: replaced hard-coded 0.1 value with dynamic calculation using PreConsumedQuota ÷ QuotaPerUnit conversion

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐰 A tiny hop, a single line does change,
Where prices once were fixed at point-one's range,
Now quotas dance in ratios so keen,
The fairest pricing model ever seen!

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: updating the task pre-consume modelPrice default to use the setting value (PreConsumedQuota/QuotaPerUnit) instead of the hard-coded 0.1.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
relay/relay_task.go (1)

143-151: Update fallback model price consistently across codebase.

The new formula at line 147 computes modelPrice = 500 / 500000 = 0.001, which is 100x smaller than the previous 0.1. However, relay/helper/price.go line 151 still uses the hardcoded fallback value of 0.1 in an identical scenario—both are fallback logic for models without explicit pricing. This inconsistency could cause different request types to receive different default pricing.

Either update relay/helper/price.go to use the same formula, or clarify if the divergence is intentional.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant