feat: 全局模型新增活跃 Provider 数量统计

- 后端优化查询,使用条件聚合同时获取总 Provider 数和活跃数
- 前端展示格式改为「活跃数/总数」,便于了解可用 Provider 情况
This commit is contained in:
fawney19
2026-02-09 22:26:30 +08:00
parent 7b28680cda
commit b11e9de6a7
5 changed files with 64 additions and 9 deletions

View File

@@ -810,6 +810,7 @@ export interface GlobalModelResponse {
config?: Record<string, any> | null
// 统计数据
provider_count?: number
active_provider_count?: number
usage_count?: number
created_at: string
updated_at?: string

View File

@@ -386,7 +386,7 @@
<Building2 class="w-4 h-4 text-muted-foreground" />
</div>
<p class="text-2xl font-bold mt-1">
{{ model.provider_count || 0 }}
{{ model.active_provider_count || 0 }}<span class="text-sm text-muted-foreground font-normal">/{{ model.provider_count || 0 }}</span>
</p>
</div>
<div class="p-3 rounded-lg border bg-muted/20">

View File

@@ -168,7 +168,7 @@
</TableCell>
<TableCell class="text-center">
<Badge variant="secondary">
{{ model.provider_count || 0 }}
{{ model.active_provider_count || 0 }}/{{ model.provider_count || 0 }}
</Badge>
</TableCell>
<TableCell class="text-center">
@@ -302,7 +302,7 @@
<!-- 第三行统计信息 -->
<div class="flex flex-wrap items-center gap-3 text-xs text-muted-foreground">
<span>提供商 {{ model.provider_count || 0 }}</span>
<span>提供商 {{ model.active_provider_count || 0 }}/{{ model.provider_count || 0 }}</span>
<span>调用 {{ formatUsageCount(model.usage_count || 0) }}</span>
<span
v-if="getFirstTierPrice(model, 'input') || getFirstTierPrice(model, 'output')"