mirror of
https://github.com/fawney19/Aether.git
synced 2026-09-02 09:20:22 +08:00
refactor: 将 global_priority 和 rate_multiplier 改为按 API 格式配置
- 新增 global_priority_by_format 字段,支持按 API 格式设置全局优先级 - 移除已废弃的 rate_multiplier 字段,统一使用 rate_multipliers - 移除已废弃的 timeout 字段(providers 和 provider_endpoints 表) - 更新调度器以支持按格式的优先级排序 - 同步更新前后端类型定义和 API 接口 - 添加数据库迁移脚本,自动迁移现有数据
This commit is contained in:
@@ -100,10 +100,9 @@ export interface ProviderKeyExport {
|
||||
name?: string | null
|
||||
note?: string | null
|
||||
api_formats: string[]
|
||||
rate_multiplier?: number
|
||||
rate_multipliers?: Record<string, number> | null
|
||||
internal_priority?: number
|
||||
global_priority?: number | null
|
||||
global_priority_by_format?: Record<string, number> | null
|
||||
rpm_limit?: number | null
|
||||
allowed_models?: any
|
||||
capabilities?: any
|
||||
|
||||
@@ -60,12 +60,11 @@ export interface UserAffinity {
|
||||
provider_id: string
|
||||
provider_name: string | null
|
||||
endpoint_id: string
|
||||
endpoint_api_format: string | null
|
||||
endpoint_url: string | null
|
||||
key_id: string
|
||||
key_name: string | null
|
||||
key_prefix: string | null // Provider Key 脱敏显示(前4...后4)
|
||||
rate_multiplier: number
|
||||
rate_multipliers: Record<string, number> | null
|
||||
global_model_id: string | null // 原始的 global_model_id(用于删除)
|
||||
model_name: string | null // 模型名称(如 claude-haiku-4-5-20250514)
|
||||
model_display_name: string | null // 模型显示名称(如 Claude Haiku 4.5)
|
||||
|
||||
@@ -86,8 +86,6 @@ export async function addProviderKey(
|
||||
api_formats: string[] // 支持的 API 格式列表(必填)
|
||||
api_key: string
|
||||
name: string
|
||||
/** @deprecated 已废弃,请使用 rate_multipliers */
|
||||
rate_multiplier?: number // [DEPRECATED] 默认成本倍率,已废弃
|
||||
rate_multipliers?: Record<string, number> | null // 按 API 格式的成本倍率
|
||||
internal_priority?: number
|
||||
rpm_limit?: number | null // RPM 限制(留空=自适应模式)
|
||||
@@ -112,11 +110,9 @@ export async function updateProviderKey(
|
||||
api_formats: string[] // 支持的 API 格式列表
|
||||
api_key: string
|
||||
name: string
|
||||
/** @deprecated 已废弃,请使用 rate_multipliers */
|
||||
rate_multiplier: number // [DEPRECATED] 默认成本倍率,已废弃
|
||||
rate_multipliers: Record<string, number> | null // 按 API 格式的成本倍率
|
||||
internal_priority: number
|
||||
global_priority: number | null
|
||||
global_priority_by_format: Record<string, number> | null // 按 API 格式的全局优先级
|
||||
rpm_limit: number | null // RPM 限制(留空=自适应模式)
|
||||
cache_ttl_minutes: number
|
||||
max_probe_interval_minutes: number
|
||||
|
||||
@@ -127,11 +127,9 @@ export interface EndpointAPIKey {
|
||||
api_key_masked: string
|
||||
api_key_plain?: string | null
|
||||
name: string // 密钥名称(必填,用于识别)
|
||||
/** @deprecated 已废弃,请使用 rate_multipliers */
|
||||
rate_multiplier: number // [DEPRECATED] 默认成本倍率,已废弃
|
||||
rate_multipliers?: Record<string, number> | null // 按 API 格式的成本倍率,如 {"CLAUDE_CLI": 1.0, "OPENAI_CLI": 0.8}
|
||||
internal_priority: number // Key 内部优先级
|
||||
global_priority?: number | null // 全局 Key 优先级
|
||||
global_priority_by_format?: Record<string, number> | null // 按 API 格式的全局优先级
|
||||
rpm_limit?: number | null // RPM 速率限制 (1-10000),null 表示自适应模式
|
||||
allowed_models?: AllowedModels // 允许使用的模型列表(null=不限制)
|
||||
capabilities?: Record<string, boolean> | null // 能力标签配置(如 cache_1h, context_1m)
|
||||
@@ -205,11 +203,9 @@ export interface EndpointAPIKeyUpdate {
|
||||
api_formats?: string[] // 支持的 API 格式列表
|
||||
name?: string
|
||||
api_key?: string // 仅在需要更新时提供
|
||||
/** @deprecated 已废弃,请使用 rate_multipliers */
|
||||
rate_multiplier?: number // [DEPRECATED] 默认成本倍率,已废弃
|
||||
rate_multipliers?: Record<string, number> | null // 按 API 格式的成本倍率
|
||||
internal_priority?: number
|
||||
global_priority?: number | null
|
||||
global_priority_by_format?: Record<string, number> | null // 按 API 格式的全局优先级
|
||||
rpm_limit?: number | null // RPM 速率限制 (1-10000),null 表示切换为自适应模式
|
||||
allowed_models?: AllowedModels
|
||||
capabilities?: Record<string, boolean> | null
|
||||
|
||||
Reference in New Issue
Block a user