fix(frontend): display time-based tier pricing correctly - #7269
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (1)
Included review availability: Your plan provides up to 10 included reviews per hour; 8 remain after this review. WalkthroughChangesTime-based pricing display
Priority: ➖ Normal Estimated code review effort: 3 (Moderate) | ~20 minutes Severity of issue fixed: Medium Merge Risk: ⚪ Minimal · up to The pricing UI now presents timezone-aware peak and off-peak tiers with their rates while preserving overnight ranges. The change is frontend-only and has no identified current merge-readiness risk. Sequence Diagram(s)sequenceDiagram
participant BillingExpression
participant parseTiersFromExpr
participant DynamicPricingBreakdown
participant PricingTierView
BillingExpression->>parseTiersFromExpr: provide time-conditioned expression
parseTiersFromExpr->>DynamicPricingBreakdown: return structured tiers
DynamicPricingBreakdown->>PricingTierView: render prices and formatted time ranges
PricingTierView-->>DynamicPricingBreakdown: display matched tier status
🚥 Pre-merge checks | ✅ 2 | ❌ 3❌ Failed checks (2 warnings, 1 inconclusive)
✅ Passed checks (2 passed)
Full details: Linked Issues checkExplanation The changes address frontend parsing, time-range formatting, matched-tier display, tier pricing values, overnight ranges, and compact or full component layouts for issue [
✨ Finishing Touches🧪 Generate unit tests (beta)
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. A rabbit reads each line, Comment |
Wait for the animated guide button to become visible instead of asserting immediately after role lookup. This avoids the opacity-zero animation race that failed CI on PR QuantumNous#7269.
English template:
.github/PULL_REQUEST_TEMPLATE/en.mdImportant
描述及代码由 AI 辅助完成。提交前请人工审阅,并对内容的准确性与完整性负责。
🔗 关联任务 / Related Issue
Closes #7268
🚀 变更类型 / Type of change
📝 变更描述 / Description
修复时间分段计费表达式在模型价格详情中无法正确展示的问题。
原先档位解析仅支持
p、c、len的数值比较,包含hour("Asia/Shanghai")的合法表达式会被误判为“特殊计费表达式”,无法展示结构化价格。本次复用已有时间条件解析和格式化逻辑,正确展示高峰、空闲两档价格,并将时段统一显示为
09:00 ~ 18:00 (Asia/Shanghai),去掉冗余的“小时”前缀,补齐小时位数。跨午夜范围保持原有起止顺序。改动仅涉及前端解析、展示及回归测试,不修改后端结算逻辑。
📸 运行证明 / Proof of Work
复现步骤:
/pricing,查看该模型的动态计费详情。预期价格,单位为 USD / 1M tokens:
验证结果:
4fc9d1f1f的解析器中复现返回空数组;修复后返回两档及全部正确单价。21:00 ~ 06:00 (UTC)跨午夜显示。✅ 提交前检查项 / Checklist
Summary by CodeRabbit
New Features
09:00 ~ 18:00, with timezone information preserved.21:00 ~ 06:00.Bug Fixes