fix(providers): correct endpoint health aggregation and display

This commit is contained in:
elky
2026-09-06 18:24:27 +08:00
parent dba5e6e9e9
commit d1b5eb08ee
9 changed files with 425 additions and 38 deletions
@@ -203,7 +203,7 @@
{{ formatApiFormatShort(endpoint.api_format) }}
</span>
<span class="font-medium text-muted-foreground/80">
{{ isEndpointAvailable(endpoint) ? `${(endpoint.health_score * 100).toFixed(0)}%` : '-' }}
{{ getEndpointHealthLabel(endpoint) }}
</span>
</div>
@@ -212,7 +212,7 @@
<div
class="h-full rounded-full transition-all duration-300"
:class="getEndpointDotColor(endpoint)"
:style="{ width: isEndpointAvailable(endpoint) ? `${Math.max(endpoint.health_score * 100, 5)}%` : '100%' }"
:style="{ width: getEndpointHealthBarWidth(endpoint) }"
/>
</div>
</div>
@@ -238,7 +238,13 @@ import Button from '@/components/ui/button.vue'
import Badge from '@/components/ui/badge.vue'
import { type ProviderWithEndpointsSummary, formatApiFormatShort } from '@/api/endpoints'
import { formatBillingType } from '@/utils/format'
import { sortEndpoints, isEndpointAvailable, getEndpointDotColor, getEndpointTooltip } from '@/features/providers/composables/useEndpointStatus'
import {
sortEndpoints,
getEndpointHealthLabel,
getEndpointHealthBarWidth,
getEndpointDotColor,
getEndpointTooltip,
} from '@/features/providers/composables/useEndpointStatus'
import { isKeyManagedProviderType } from '../utils/providerTypeUtils'
import { useI18n } from '@/i18n'
import { safeExternalWebUrl } from '@/utils/navigationSecurity'