mirror of
https://github.com/fawney19/Aether.git
synced 2026-10-08 10:27:46 +08:00
feat: 缓存计费细分、能力匹配优化、用户模型调用计数
1. 缓存创建 tokens 区分 5min/1h TTL,支持按缓存时长差异化计费 - Usage 表新增 cache_creation_input_tokens_5m/1h 字段 - Claude handler 解析新格式 (ephemeral_5m/1h, claude_cache_creation_5/1h) - 计费规则支持 cache_ttl_pricing 覆盖 cache_creation 价格 2. 能力匹配机制优化 - COMPATIBLE 能力不再硬过滤,改为排序阶段通过 capability_miss_count 优先级处理 - cache_1h 改为 COMPATIBLE + REQUEST_PARAM(自动检测请求体中的 ttl=1h) - gemini_files 改为 EXCLUSIVE + REQUEST_PARAM(自动检测 fileData.fileUri) - 移除前端模型偏好/能力配置 UI(不再需要用户手动配置) 3. 新增用户-模型维度调用次数计数器 (UserModelUsageCount) - 原子递增,避免从 Usage 表聚合查询 - 前端模型目录和用户可用模型列表展示调用次数 4. 其他改进 - global_model_id 改为必填(NOT NULL),清理孤立模型 - 模型映射对话框支持从上游获取模型列表并分组折叠 - 端点测试不再依赖端点启用状态 - 异步任务页面对普通用户隐藏用户信息列 - Dashboard 响应式布局断点调整 (sm -> lg) - 号池管理仅展示已启用号池的提供商
This commit is contained in:
@@ -325,6 +325,7 @@
|
||||
:models="models"
|
||||
:editing-group="editingGroup"
|
||||
:preselected-model-id="preselectedModelId"
|
||||
:has-auto-fetch-key="hasAutoFetchKey"
|
||||
@saved="onDialogSaved"
|
||||
/>
|
||||
|
||||
@@ -420,6 +421,11 @@ const aliasMappingPreview = computed(() => props.mappingPreview ?? null)
|
||||
const providerEndpoints = computed(() => props.endpoints ?? [])
|
||||
const providerKeysState = computed(() => props.providerKeys ?? [])
|
||||
|
||||
// 是否有 key 配置了自动获取上游模型
|
||||
const hasAutoFetchKey = computed(() => {
|
||||
return providerKeysState.value.some(k => k.auto_fetch_models)
|
||||
})
|
||||
|
||||
// 展开状态
|
||||
const expandedItems = ref<Set<string>>(new Set())
|
||||
|
||||
@@ -641,18 +647,17 @@ async function onDialogSaved() {
|
||||
emit('refresh')
|
||||
}
|
||||
|
||||
// 获取可用的 API 格式(有活跃端点,去重)
|
||||
// 获取可用的 API 格式(所有端点,去重;测试只关注 Key 是否支持,不依赖端点启用状态)
|
||||
const availableApiFormats = computed(() => {
|
||||
const formats = new Set(
|
||||
providerEndpoints.value
|
||||
.filter(ep => ep.is_active)
|
||||
.map(ep => ep.api_format)
|
||||
)
|
||||
return [...formats]
|
||||
})
|
||||
|
||||
// 获取映射项支持的 API 格式
|
||||
// 逻辑:找到支持该映射格式的所有活跃 Key,获取这些 Key 支持的所有格式,与活跃端点格式取交集
|
||||
// 逻辑:找到支持该映射格式的所有活跃 Key,获取这些 Key 支持的所有格式,与端点格式取交集
|
||||
function getItemAvailableFormats(item: CombinedMapping): string[] {
|
||||
// 精确映射:基于 group.apiFormats 筛选
|
||||
if (item.type === 'exact' && item.group?.apiFormats && item.group.apiFormats.length > 0) {
|
||||
@@ -677,7 +682,7 @@ function getItemAvailableFormats(item: CombinedMapping): string[] {
|
||||
}
|
||||
}
|
||||
|
||||
// 与活跃端点格式取交集
|
||||
// 与端点格式取交集
|
||||
return availableApiFormats.value.filter(fmt => keyFormats.has(fmt))
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user