feat(channel): 通配符定价匹配 + OpenAI BillingModelSource + 按次价格校验 + 用户端计费模式展示
- 定价查找支持通配符(suffix *),最长前缀优先匹配 - 模型限制(restrict_models)同样支持通配符匹配 - OpenAI 网关接入渠道映射/BillingModelSource/模型限制 - 按次/图片计费模式创建时强制要求价格或层级(前后端) - 用户使用记录列表增加计费模式 badge 列
This commit is contained in:
@@ -876,6 +876,19 @@ async function handleSubmit() {
|
||||
return
|
||||
}
|
||||
|
||||
// 校验 per_request/image 模式必须有价格
|
||||
for (const section of form.platforms) {
|
||||
for (const entry of section.model_pricing) {
|
||||
if (entry.models.length === 0) continue
|
||||
if ((entry.billing_mode === 'per_request' || entry.billing_mode === 'image') &&
|
||||
(entry.per_request_price == null || entry.per_request_price === '') &&
|
||||
(!entry.intervals || entry.intervals.length === 0)) {
|
||||
appStore.showError(t('admin.channels.perRequestPriceRequired', '按次/图片计费模式必须设置默认价格或至少一个计费层级'))
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const { group_ids, model_pricing, model_mapping } = formToAPI()
|
||||
console.log('[handleSubmit] model_pricing to send:', JSON.stringify(model_pricing))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user