feat: doubao-seedance-2-0-260128支持按分辨率区分计费 - #5300
Conversation
WalkthroughThe Doubao billing estimator is updated to compute video-input discounts based on output resolution (1080p vs. non-1080p) and video presence. The pricing table replaces a fixed ratio map, and ChangesDoubao Video Input Pricing by Resolution
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ 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. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
relay/channel/task/doubao/constants.go (1)
40-45: 💤 Low valueDocument/validate the base-price ↔ ModelRatio coupling.
The multiplier is
price/basewherebaseis the hard-coded 480p/720p no-video price (46.0 / 37.0). Billing is only correct if the admin-configuredModelRatioequals that base. The comment notes this, but it's a silent assumption: ifModelRatiois set to any other value the resolution/video multipliers will be proportionally wrong. Consider surfacing this expectation in operator docs.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@relay/channel/task/doubao/constants.go` around lines 40 - 45, GetVideoInputRatio assumes admin-configured ModelRatio equals the hard-coded base price (videoPriceTable lookup using videoPriceKey{}), which silently breaks billing if ModelRatio differs; update GetVideoInputRatio (and related initialization) to validate that ModelRatio matches the expected base (videoPriceTable[modelName][videoPriceKey{}]) and either compute multipliers relative to the configured ModelRatio or emit a clear runtime warning/error when they diverge; reference videoPriceTable, videoPriceKey{}, base and ModelRatio so the code locates the check and handle the mismatch by logging an explicit error or adjusting calculations to use the configured ModelRatio as the denominator.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@relay/channel/task/doubao/constants.go`:
- Around line 40-45: GetVideoInputRatio assumes admin-configured ModelRatio
equals the hard-coded base price (videoPriceTable lookup using videoPriceKey{}),
which silently breaks billing if ModelRatio differs; update GetVideoInputRatio
(and related initialization) to validate that ModelRatio matches the expected
base (videoPriceTable[modelName][videoPriceKey{}]) and either compute
multipliers relative to the configured ModelRatio or emit a clear runtime
warning/error when they diverge; reference videoPriceTable, videoPriceKey{},
base and ModelRatio so the code locates the check and handle the mismatch by
logging an explicit error or adjusting calculations to use the configured
ModelRatio as the denominator.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 80877c64-7592-44a0-a741-af98150f6ef9
📒 Files selected for processing (2)
relay/channel/task/doubao/adaptor.gorelay/channel/task/doubao/constants.go
|
前端模型广场 显示还是没有区分计费 |
|
需要这个feat,尽快合并 |
* feat: improve advanced custom route editor * Bump Electron lockfile dependencies * feat: bill doubao seedance-2.0 by output resolution and video input (QuantumNous#5300) * feat: support doubao seedance 2.0 safety_identifier/priority and 4k billing (QuantumNous#5824) * feat: support safety_identifier and priority for doubao video * feat: add 4k resolution billing tier for doubao video * chore: run `bun format` to automatically format the frontend code * fix(web): 修复自定义 HTML 样式被过滤及排版间距异常的问题 (QuantumNous#5795) * fix(web): 修复自定义 HTML 样式被过滤及排版间距异常的问题 * fix(web): isolate custom HTML rendering --------- Co-authored-by: CaIon <i@caion.me> * feat: support Wan2.7 i2v media mapping (QuantumNous#4984) * feat: support Wan2.7 i2v media mapping * fix: normalize wan2.7 i2v image inputs * perf(web): optimize web Rsbuild and Tailwind build pipeline (QuantumNous#5786) * fix(dev): run only default frontend in dev-web - simplify make dev-web to install default dependencies and start web/default only. - keep dev-web-classic as the standalone classic entry and scope its install to classic. * chore(build): align make targets with web naming - rename frontend make targets and variables to use the web terminology consistently. - keep default and classic dev port overrides available under the updated names. * fix(web): inject app styles into isolated HTML (QuantumNous#5860) - clone loaded application style nodes into the Shadow DOM for custom HTML rendering. - keep HTML rendering isolated while restoring layout and typography that depend on app CSS. * fix: keep page state when switching tabs within the same route (QuantumNous#5796) AnimatedOutlet keyed its motion container by the full pathname, so navigating between params of the same route (e.g. the dashboard tabs under /dashboard/$section) changed the key and remounted the route component, discarding its in-memory state. The most visible symptom: the dashboard time range resets to the default every time you switch sub-tabs (Model Analytics / Flow / User Analytics). Key the transition by the matched route id instead, so param-only navigation re-renders in place while real page-to-page navigation still plays the enter animation. This also preserves state across the other $section tab pages (usage logs, models, system settings). * 支持服务优雅关闭,避免重启回复中断和面板缓存数据丢失 (QuantumNous#4258) * feat: add graceful shutdown with configurable timeout * fix: flush quota dashboard cache on graceful shutdown Persist the in-memory CacheQuotaData aggregation to the quota_data table before process exit, so a restart no longer drops up to one DataExportInterval window of dashboard data (issue QuantumNous#5679). * docs: update AGENTS.md * Make quota logging synchronous and delay startup log --------- Co-authored-by: CaIon <i@caion.me> Co-authored-by: feitianbubu <feitianbubu@qq.com> Co-authored-by: t0ng7u <dev@aiass.cc> Co-authored-by: olwater <52482488+olwater@users.noreply.github.com> Co-authored-by: Scott <sc908181134@gmail.com> Co-authored-by: QuentinHsu <xuquentinyang@gmail.com> Co-authored-by: henrydontbbai <268972047+henrydontbbai@users.noreply.github.com>
…uantumNous#5300) (cherry picked from commit c8491b4)
…uantumNous#5300) (cherry picked from commit c8491b4)
…uantumNous#5300) (cherry picked from commit c8491b4)
修复: #5266

sd2.0, 之前只根据是否包含视频url区分计费
新增了1080p分辨率后, 又增加了根据是否1080p区分计费
📝 变更描述 / Description
增加是否1080p计费配置, 与是否包含视频url配置成价格map
等后续将视频也支持表达式计费后可不再通过价格map写死 @Calcium-Ion
📸 运行证明 / Proof of Work
Summary by CodeRabbit