mirror of
https://github.com/fawney19/Aether.git
synced 2026-10-10 19:29:50 +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:
@@ -1126,17 +1126,10 @@ function getKeyApiFormats(key: EndpointAPIKey, endpoint?: ProviderEndpointWithKe
|
||||
|
||||
// 获取密钥在指定 API 格式下的成本倍率
|
||||
function getKeyRateMultiplier(key: EndpointAPIKey, format: string): number {
|
||||
// 优先使用 rate_multipliers 中指定格式的倍率
|
||||
if (key.rate_multipliers && key.rate_multipliers[format] !== undefined) {
|
||||
return key.rate_multipliers[format]
|
||||
}
|
||||
// 如果 rate_multipliers 存在但该格式未配置,说明用户期望使用默认值 1.0
|
||||
// 只有当 rate_multipliers 完全不存在时,才回退到 rate_multiplier
|
||||
if (key.rate_multipliers && Object.keys(key.rate_multipliers).length > 0) {
|
||||
return 1.0
|
||||
}
|
||||
// 回退到默认倍率
|
||||
return key.rate_multiplier || 1.0
|
||||
return 1.0
|
||||
}
|
||||
|
||||
// 健康度颜色
|
||||
|
||||
Reference in New Issue
Block a user