Skip to content

fix: 修复模型广场显示未定价的模型 - #6177

Open
YDHusky wants to merge 1 commit into
QuantumNous:mainfrom
YDHusky:main
Open

YDHusky wants to merge 1 commit into
QuantumNous:mainfrom
YDHusky:main

Conversation

@YDHusky

@YDHusky YDHusky commented Jul 13, 2026 •

Copy link
Copy Markdown

⚠️ 提交说明 / PR Notice

模型广场会显示未定价的模型,提交修复了只显示已定价的模型

📝 变更描述 / Description

统一新增模型计费配置判断,支持固定价格、倍率配置和有效的阶梯计费表达式。模型广场构建定价列表时会跳过未配置任何有效计费规则的模型,避免使用默认倍率 37.5 生成错误价格;同时复用该判断逻辑,确保模型列表与模型广场的可见性保持一致。补充回归断言,覆盖未定价模型、空阶梯表达式模型和缺失阶梯表达式模型。

🚀 变更类型 / Type of change

  • 🐛 Bug 修复 (Bug fix) - 请关联对应 Issue,避免将设计取舍、理解偏差或预期不一致直接归类为 bug
  • ✨ 新功能 (New feature) - 重大特性建议先通过 Issue 沟通
  • ⚡ 性能优化 / 重构 (Refactor)
  • 📝 文档更新 (Documentation)

🔗 关联任务 / Related Issue

  • Closes # (如有)

✅ 提交前检查项 / Checklist

  • 人工确认: 我已亲自整理并撰写此描述,没有直接粘贴未经处理的 AI 输出。
  • 非重复提交: 我已搜索现有的 Issues 与 PRs,确认不是重复提交。
  • Bug fix 说明: 若此 PR 标记为 Bug fix,我已提交或关联对应 Issue,且不会将设计取舍、预期不一致或理解偏差直接归类为 bug。
  • 变更理解: 我已理解这些更改的工作原理及可能影响。
  • 范围聚焦: 本 PR 未包含任何与当前任务无关的代码改动。
  • 本地验证: 已在本地运行并通过测试或手动验证,维护者可以据此复核结果。
  • 安全合规: 代码中无敏感凭据,且符合项目代码规范。

📸 运行证明 / Proof of Work

5f9d4cdee52d1038c0cdb79966548d83

Summary by CodeRabbit

  • Bug Fixes
    • Models without valid billing configuration are no longer included in pricing data.
    • Tiered billing models are recognized only when they have a non-empty billing expression.
    • Pricing listings now exclude unpriced or incompletely configured models while retaining properly configured tiered models.

@coderabbitai

coderabbitai Bot commented Jul 13, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: f59eefee-9a16-4c45-a4cf-1c50e711508b

📥 Commits

Reviewing files that changed from the base of the PR and between 7c28993 and 5e5a96b.

📒 Files selected for processing (4)
  • controller/model_list_test.go
  • model/pricing.go
  • relay/helper/price.go
  • setting/billing_setting/tiered_billing.go

Walkthrough

Changes

Billing configuration filtering

Layer / File(s) Summary
Centralize billing configuration detection
setting/billing_setting/tiered_billing.go, relay/helper/price.go
Adds shared validation for fixed-price, ratio, and non-blank tiered-expression configurations, and delegates relay checks to it.
Filter unconfigured models from pricing
model/pricing.go, controller/model_list_test.go
Skips models without billing configuration during pricing construction and updates model-list assertions accordingly.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related issues

Possibly related PRs

Suggested reviewers: calcium-ion, seefs001, yyhhyyyyyy, feitianbubu

Poem

A rabbit checks the billing trail,
Blank tiers vanish from the sale.
Ratios guide the pricing flight,
Tiered expressions must be right.
The model list now hops in tune.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 22.22% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed 标题准确概括了本次修复:模型广场不再展示未定价模型。
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

JacksonsY added a commit to JacksonsY/new-api that referenced this pull request Jul 15, 2026
PR QuantumNous#6177(隐藏未定价模型)只更新了 controller/model_list_test.go,漏了上游
model/pricing_endpoint_test.go(来自 PR QuantumNous#5825)——后者用未定价模型验证 endpoint 类型推断,
依赖「未定价模型出现在 GetPricing」。PR 后非自用模式下这些模型被排除,7 个测试挂。
在共享 helper resetPricingEndpointTestTables 临时开启自用模式(带还原),让未定价测试模型
仍以默认档暴露、复刻 PR 前可见性;endpoint 推断断言不受影响。合并上游若其补了同一测试需
留意此处。

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
@Calcium-Ion
Calcium-Ion force-pushed the main branch 2 times, most recently from 51fdfc5 to 2b6f1df Compare August 30, 2026 15:03

This branch has not been deployed

No deployments
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