feat(channel): 缓存扁平化 + 网关映射集成 + 计费模式统一 + 模型限制

- 缓存重构为 O(1) 哈希结构 (pricingByGroupModel, mappingByGroupModel)
- 渠道模型映射接入网关流程 (Forward 前应用, a→b→c 映射链)
- 新增 billing_model_source 配置 (请求模型/最终模型计费)
- usage_logs 新增 channel_id, model_mapping_chain, billing_tier 字段
- 每种计费模式统一支持默认价格 + 区间定价
- 渠道模型限制开关 (restrict_models)
- 分组按平台分类展示 + 彩色图标
- 必填字段红色星号 + 模型映射 UI
- 去除模型通配符支持
This commit is contained in:
erio
2026-03-30 13:26:05 +08:00
parent 29d58f2414
commit ebac0dc628
23 changed files with 779 additions and 206 deletions

View File

@@ -29,6 +29,7 @@ export interface ChannelModelPricing {
cache_write_price: number | null
cache_read_price: number | null
image_output_price: number | null
per_request_price: number | null
intervals: PricingInterval[]
}
@@ -37,8 +38,11 @@ export interface Channel {
name: string
description: string
status: string
billing_model_source: string // "requested" | "upstream"
restrict_models: boolean
group_ids: number[]
model_pricing: ChannelModelPricing[]
model_mapping: Record<string, string>
created_at: string
updated_at: string
}
@@ -48,6 +52,9 @@ export interface CreateChannelRequest {
description?: string
group_ids?: number[]
model_pricing?: ChannelModelPricing[]
model_mapping?: Record<string, string>
billing_model_source?: string
restrict_models?: boolean
}
export interface UpdateChannelRequest {
@@ -56,6 +63,9 @@ export interface UpdateChannelRequest {
status?: string
group_ids?: number[]
model_pricing?: ChannelModelPricing[]
model_mapping?: Record<string, string>
billing_model_source?: string
restrict_models?: boolean
}
interface PaginatedResponse<T> {