mirror of
https://github.com/fawney19/Aether.git
synced 2026-10-10 19:29:50 +08:00
feat(keys): 新增密钥自动获取模型功能
- 添加 auto_fetch_models 字段支持定时从上游 API 获取可用模型 - 添加 locked_models 字段支持锁定模型,刷新时不会被删除 - 新增 ModelFetchScheduler 调度器定期执行模型获取任务 - 前端 KeyFormDialog 添加自动获取模型开关 - 前端 KeyAllowedModelsEditDialog 支持模型锁定操作 - ProviderDetailDrawer 显示密钥同步状态 - 数据库迁移添加新字段
This commit is contained in:
@@ -309,6 +309,17 @@
|
||||
@keydown="(e) => handlePriorityKeydown(e, key)"
|
||||
@blur="handlePriorityBlur(key)"
|
||||
>
|
||||
<!-- 自动获取模型状态 -->
|
||||
<template v-if="key.auto_fetch_models">
|
||||
<span class="text-muted-foreground/40">|</span>
|
||||
<span
|
||||
class="cursor-help"
|
||||
:class="key.last_models_fetch_error ? 'text-amber-600 dark:text-amber-400' : ''"
|
||||
:title="getAutoFetchStatusTitle(key)"
|
||||
>
|
||||
{{ key.last_models_fetch_error ? '同步失败' : '自动同步' }}
|
||||
</span>
|
||||
</template>
|
||||
<!-- RPM 限制信息(第二位) -->
|
||||
<template v-if="key.rpm_limit || key.is_adaptive">
|
||||
<span class="text-muted-foreground/40">|</span>
|
||||
@@ -1596,6 +1607,22 @@ function getHealthScoreBarColor(score: number): string {
|
||||
return 'bg-red-500 dark:bg-red-400'
|
||||
}
|
||||
|
||||
// 获取自动获取模型状态的 title 提示
|
||||
function getAutoFetchStatusTitle(key: EndpointAPIKey): string {
|
||||
const parts: string[] = ['自动获取模型已启用']
|
||||
|
||||
if (key.last_models_fetch_at) {
|
||||
const date = new Date(key.last_models_fetch_at)
|
||||
parts.push(`上次同步: ${date.toLocaleString()}`)
|
||||
}
|
||||
|
||||
if (key.last_models_fetch_error) {
|
||||
parts.push(`错误: ${key.last_models_fetch_error}`)
|
||||
}
|
||||
|
||||
return parts.join('\n')
|
||||
}
|
||||
|
||||
// 检查指定格式是否熔断
|
||||
function isFormatCircuitOpen(key: EndpointAPIKey, format: string): boolean {
|
||||
if (!key.circuit_breaker_by_format) return false
|
||||
|
||||
Reference in New Issue
Block a user