Return error when model price/ratio unset - #3081
Conversation
QuantumNous#3079 Change ModelPriceHelperPerCall to return (PriceData, error) and stop silently falling back to a default price. If a model price is not configured the helper now returns an error (unless the user has AcceptUnsetRatioModel enabled and a ratio exists). Propagate this error to callers: Midjourney handlers now return a MidjourneyResponse with Code 4 and the error message, and task submission returns a wrapped task error with HTTP 400. Also extract remix video_id in ResolveOriginTask for remix actions. This enforces explicit model price/ratio configuration and surfaces configuration issues to clients.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review infoConfiguration used: Organization UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (3)
WalkthroughThe PR updates the price helper function to return an error in addition to price data, enabling proper error propagation for missing configuration. Callers are updated to handle these errors, returning appropriate error responses instead of proceeding with invalid data. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 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 |
Return error when model price/ratio unset
#3079
将 ModelPriceHelperPerCall 辅助函数的返回值修改为 (PriceData, error),并停止静默回退到默认价格。若模型价格未配置,该辅助函数现在会返回错误(除非用户已启用 AcceptUnsetRatioModel 且存在对应比例)。
将此错误传播给调用方:Midjourney 处理器现在会返回一个 Code 为 4 且包含错误信息的 MidjourneyResponse;任务提交则会返回一个包装后的任务错误,并附带 HTTP 400 状态码。
此外,在 ResolveOriginTask 中为 remix 操作提取 video_id。
此修改强制要求显式配置模型价格 / 比例,并将配置问题暴露给客户端。