Fix verified image pricing and settle async image usage
This commit is contained in:
1 parent
4c4f5ad68d
commit
8a13ef9c02
22 files changed
+506
-40
No files matched your search
@@ -36,6 +36,7 @@ export interface CatalogModel {
|
||||
input?: number
|
||||
output?: number
|
||||
cachedInput?: number
|
||||
imageInput?: number
|
||||
unit?: string
|
||||
discount?: number
|
||||
discountLabel?: string
|
||||
@@ -48,6 +49,8 @@ export interface CatalogModel {
|
||||
}
|
||||
pricingConfigured?: boolean
|
||||
billingReady?: boolean
|
||||
billingReason?: string
|
||||
integrationDeferred?: boolean
|
||||
priority?: number
|
||||
maxConcurrency?: number
|
||||
executionReady?: boolean
|
||||
|
||||
@@ -43,6 +43,7 @@ export function summarizeModelCatalog(
|
||||
|
||||
for (const route of routes) {
|
||||
if (route.status !== 'active' || !publishedModelIds.has(route.logicalModelId) || !activeProviderIds.has(route.providerId)) continue
|
||||
if (route.integrationDeferred) continue
|
||||
if (route.pricingConfigured !== true) {
|
||||
unpricedRoutes++
|
||||
continue
|
||||
|
||||
@@ -3,6 +3,7 @@ export interface DisplayPricing {
|
||||
input?: number
|
||||
output?: number
|
||||
cachedInput?: number
|
||||
imageInput?: number
|
||||
unit?: string
|
||||
discount?: number
|
||||
discountLabel?: string
|
||||
@@ -81,10 +82,12 @@ export function platformPriceLabel(pricing?: DisplayPricing) {
|
||||
if (!pricing) return '价格待配置'
|
||||
if (isTokenUnit(pricing.unit)) {
|
||||
const unit = pricing.unit === 'CNY / 1M tokens' ? '人民币 / 1M(一百万 Token)' : pricing.unit || '人民币 / 1M(一百万 Token)'
|
||||
return `${numberLabel(pricing.input)} 输入 / ${numberLabel(pricing.output)} 输出 · ${unit}`
|
||||
const image = pricing.imageInput === undefined ? '' : ` / ${numberLabel(pricing.imageInput)} 图像输入`
|
||||
return `${numberLabel(pricing.input)} ${image ? '文字输入' : '输入'}${image} / ${numberLabel(pricing.output)} 输出 · ${unit}`
|
||||
}
|
||||
const price = pricing.price ?? pricing.input
|
||||
return price === undefined ? `计费单位:${unitLabel(pricing.unit)}` : `平台售价 ${numberLabel(price)} / ${unitSuffix(pricing)}`
|
||||
const suffix = ({ image: '张(单张请求)', task: '任务', generation: '次生成' } as Record<string, string>)[unitSuffix(pricing)] || unitSuffix(pricing)
|
||||
return price === undefined ? `计费单位:${unitLabel(pricing.unit)}` : `平台售价 ${numberLabel(price)} / ${suffix}`
|
||||
}
|
||||
|
||||
/** Explicit admin action. Settlement still uses saved CNY rates, never applies a second discount. */
|
||||
|
||||
@@ -44,6 +44,7 @@ export interface ModelItem {
|
||||
input?: number
|
||||
output?: number
|
||||
cachedInput?: number
|
||||
imageInput?: number
|
||||
unit?: string
|
||||
discount?: number
|
||||
discountLabel?: string
|
||||
@@ -55,6 +56,8 @@ export interface ModelItem {
|
||||
}
|
||||
pricingConfigured?: boolean
|
||||
billingReady?: boolean
|
||||
billingReason?: string
|
||||
integrationDeferred?: boolean
|
||||
priority?: number
|
||||
maxConcurrency?: number
|
||||
executionReady?: boolean
|
||||
|
||||
@@ -348,15 +348,17 @@ function hasCallableGroup(model: GalleryModel) {
|
||||
|
||||
function modelAvailabilityLabel(model: GalleryModel) {
|
||||
if (!model.groups.length) return '待上线'
|
||||
if (model.groups.every(group => group.integrationDeferred)) return '暂不接入'
|
||||
if (hasCallableGroup(model)) return '在线'
|
||||
if (model.mode === '异步' && model.groups.some(group => group.pricingConfigured && group.executionReady === false)) return '异步执行器待接入'
|
||||
if (model.mode === '异步' && model.groups.some(group => group.pricingConfigured && group.billingReady === false)) return '异步按任务计费待配置'
|
||||
if (model.mode === '异步' && model.groups.some(group => group.pricingConfigured && group.billingReady === false)) return '用量计费待核实'
|
||||
return '价格待配置'
|
||||
}
|
||||
|
||||
function modelUnavailableLabel(model: GalleryModel) {
|
||||
if (model.groups.length && model.groups.every(group => group.integrationDeferred)) return '暂不接入'
|
||||
if (model.mode === '异步' && model.groups.some(group => group.pricingConfigured && group.executionReady === false)) return '异步执行器待接入'
|
||||
if (model.mode === '异步' && model.groups.some(group => group.pricingConfigured && group.billingReady === false)) return '异步按任务计费待配置'
|
||||
if (model.mode === '异步' && model.groups.some(group => group.pricingConfigured && group.billingReady === false)) return '用量计费待核实'
|
||||
return '价格待配置'
|
||||
}
|
||||
|
||||
@@ -617,7 +619,7 @@ function mapCatalogModels(items: unknown, providers: unknown): ModelItem[] {
|
||||
...mapCatalogModel(item), logicalModelId: item.logicalModelId, gatewayModelId: item.gatewayModelId,
|
||||
provider: providerNames.get(providerId) || providerId || '未知渠道',
|
||||
vendorName: model.vendorName,
|
||||
sourceLabel: model.sourceLabel, pricing: model.pricing, pricingConfigured: model.pricingConfigured, billingReady: model.billingReady, priority: model.priority, maxConcurrency: model.maxConcurrency, executionReady: model.executionReady, inputTypes, outputTypes,
|
||||
sourceLabel: model.sourceLabel, pricing: model.pricing, pricingConfigured: model.pricingConfigured, billingReady: model.billingReady, billingReason: model.billingReason, integrationDeferred: model.integrationDeferred, priority: model.priority, maxConcurrency: model.maxConcurrency, executionReady: model.executionReady, inputTypes, outputTypes,
|
||||
}
|
||||
})
|
||||
}
|
||||
@@ -975,7 +977,8 @@ $env:OPENAI_API_KEY="你的 MOYI 用户 API Key"
|
||||
<label>调用模型 ID <code>{{ gatewayModelId(group) }}</code></label>
|
||||
<button class="text-link" @click="copy(gatewayModelId(group), '调用模型 ID', gatewayModelId(group))"><Copy :size="14" />{{ copySucceeded(gatewayModelId(group)) ? '已复制' : '复制调用 ID' }}</button>
|
||||
<small class="drawer-pricing">标准价:{{ groupStandardPriceLabel(group) }} · {{ groupPriceLabel(group) }} · 对外 {{ groupDiscountLabel(group) }}</small>
|
||||
<button class="button secondary" :disabled="!group.pricingConfigured || group.billingReady === false || group.executionReady === false" @click="tryModel({ ...selectedModel, groups: [group] })">{{ !group.pricingConfigured ? '价格待配置' : group.executionReady === false ? '异步执行器待接入' : group.billingReady === false ? '异步按任务计费待配置' : '试用此分组' }}</button>
|
||||
<p v-if="group.billingReason" class="request-unavailable">{{ group.billingReason }}</p>
|
||||
<button class="button secondary" :disabled="!group.pricingConfigured || group.billingReady === false || group.executionReady === false" @click="tryModel({ ...selectedModel, groups: [group] })">{{ group.integrationDeferred ? '暂不接入' : !group.pricingConfigured ? '报价待核实' : group.executionReady === false ? '执行接口待接入' : group.billingReady === false ? '用量计费待核实' : '试用此分组' }}</button>
|
||||
</section>
|
||||
<template #footer><button class="button primary full" :disabled="!hasCallableGroup(selectedModel)" @click="tryModel(selectedModel)"><Play :size="16" />{{ !selectedModel.groups.length ? '分组待上线' : hasCallableGroup(selectedModel) ? '在线试用' : modelUnavailableLabel(selectedModel) }}</button><button class="button secondary full" @click="selectedModel = null; emit('navigate', 'docs')"><BookOpen :size="16" />查看文档</button></template>
|
||||
</SlidePanel>
|
||||
|
||||
Reference in new issue
Block a user