fix: /v1/responses/compact default billing - #2766
Conversation
WalkthroughThe Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
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. Comment |
There was a problem hiding this comment.
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)
setting/ratio_setting/model_ratio.go (1)
462-468: Remove commented-out code and fix semantic inconsistency in return values.The fix correctly changes default billing for compact-suffix models from 0 to 37.5. However, there's a critical semantic issue:
The commented-out line should be removed entirely.
More importantly, the
existsreturn value now returnsoperation_setting.SelfUseModeEnabledinstead oftrue. This creates a breaking change in behavior:
- Previously: Compact models not in the ratio map returned
success=true(indicating a valid result)- Now: They return
success=SelfUseModeEnabled, which defaults tofalseThis breaks callers like
relay/helper/price.go:71that treat!successas an error condition. With the defaultSelfUseModeEnabled=false, all unfound compact models will now trigger the error "ratio or price not set, please start self-use mode"—even though a valid ratio (37.5) is being returned. This contradicts the intended fix.The return statement should either:
- Keep
success=trueto maintain the semantic contract that a valid ratio was found, or- Update all affected callers to handle the new semantics where
successnow means "SelfUseModeEnabled"Suggested fix
if !ok { if strings.HasSuffix(name, CompactModelSuffix) { if wildcardRatio, ok := modelRatioMap[CompactWildcardModelKey]; ok { return wildcardRatio, true, name } - //return 0, true, name } - return 37.5, operation_setting.SelfUseModeEnabled, name + return 37.5, true, name }
…t-price fix: /v1/responses/compact default billing
/v1/responses/compact 由默认免费调整为默认计费
Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.