mirror of
https://github.com/fawney19/Aether.git
synced 2026-10-08 10:27:46 +08:00
fix(usage): unify OpenAI Live and WebSocket records
This commit is contained in:
@@ -8,7 +8,7 @@
|
||||
:lookback-hours="lookbackHours"
|
||||
:fallback-segments="segmentCount ?? GRID_COUNT"
|
||||
entity-label="端点"
|
||||
:entity-name="monitor?.api_format"
|
||||
:entity-name="monitor?.api_format ? formatApiFormat(monitor.api_format) : undefined"
|
||||
/>
|
||||
<div
|
||||
v-else
|
||||
@@ -51,6 +51,7 @@
|
||||
<script setup lang="ts">
|
||||
import { computed } from 'vue'
|
||||
import type { EndpointStatusMonitor, EndpointHealthEvent, PublicEndpointStatusMonitor, PublicHealthEvent } from '@/api/endpoints'
|
||||
import { formatApiFormat } from '@/api/endpoints/types/api-format'
|
||||
import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from '@/components/ui/tooltip'
|
||||
import HealthStatusTimeline from './HealthStatusTimeline.vue'
|
||||
import { formatTimestamp, formatTimelineTooltip } from './health-monitor-utils'
|
||||
@@ -225,7 +226,7 @@ function buildSegmentTooltip(
|
||||
avg_tps: null
|
||||
},
|
||||
entityLabel: '端点',
|
||||
entityName: props.monitor?.api_format
|
||||
entityName: props.monitor?.api_format ? formatApiFormat(props.monitor.api_format) : undefined
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -478,6 +478,7 @@ import {
|
||||
groupApiFormats,
|
||||
parseApiFormat,
|
||||
API_FORMAT_KIND_LABELS,
|
||||
formatApiFormat,
|
||||
formatApiFormatShort,
|
||||
normalizeApiFormatAlias,
|
||||
} from '@/api/endpoints/types/api-format'
|
||||
@@ -573,7 +574,7 @@ function poolKeySummary(key: KeyWithMeta): string {
|
||||
}
|
||||
|
||||
function emptyFormatKeyText(format: string): string {
|
||||
return legacyT(`暂无 ${format} 格式的 Key`)
|
||||
return legacyT(`暂无 ${formatApiFormat(format)} 格式的 Key`)
|
||||
}
|
||||
|
||||
function localizedApiError(error: unknown, fallback: string): string {
|
||||
|
||||
@@ -373,6 +373,7 @@ import {
|
||||
type ProviderModelAlias,
|
||||
type ProviderMappingPreviewResponse,
|
||||
} from '@/api/endpoints'
|
||||
import { formatApiFormat } from '@/api/endpoints/types/api-format'
|
||||
import { type EndpointAPIKey } from '@/api/endpoints/keys'
|
||||
import { updateModel } from '@/api/endpoints/models'
|
||||
import { useI18n } from '@/i18n'
|
||||
@@ -907,7 +908,7 @@ async function handleStartMappingTest() {
|
||||
await modelTest.startTest({
|
||||
mode: 'direct',
|
||||
modelName: testingModelName.value,
|
||||
displayLabel: `[${endpoint.api_format}] 映射 "${testingModelName.value}"`,
|
||||
displayLabel: `[${formatApiFormat(endpoint.api_format)}] 映射 "${testingModelName.value}"`,
|
||||
apiFormat: endpoint.api_format,
|
||||
endpointId: endpoint.id,
|
||||
endpointBaseUrl: endpoint.base_url,
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
import { describe, expect, it } from 'vitest'
|
||||
|
||||
import { getEndpointTooltip } from '../useEndpointStatus'
|
||||
|
||||
describe('getEndpointTooltip', () => {
|
||||
it('formats the internal Codex Live id at the user-visible tooltip boundary', () => {
|
||||
const tooltip = getEndpointTooltip({
|
||||
api_format: 'codex:live',
|
||||
health_score: 1,
|
||||
is_active: true,
|
||||
total_keys: 1,
|
||||
active_keys: 1,
|
||||
}, 'zh-CN')
|
||||
|
||||
expect(tooltip).toBe('OpenAI Live: 健康度 100%')
|
||||
expect(tooltip).not.toContain('codex:live')
|
||||
})
|
||||
})
|
||||
@@ -1,5 +1,5 @@
|
||||
import type { EndpointHealthDetail } from '@/api/endpoints'
|
||||
import { compareApiFormats } from '@/api/endpoints/types/api-format'
|
||||
import { compareApiFormats, formatApiFormat } from '@/api/endpoints/types/api-format'
|
||||
import { defaultLocale, translateLegacyText, type Locale } from '@/i18n/messages'
|
||||
|
||||
// 端点状态枚举
|
||||
@@ -58,7 +58,7 @@ export function getEndpointDotColor(endpoint: EndpointHealthDetail): string {
|
||||
* 端点提示文本
|
||||
*/
|
||||
export function getEndpointTooltip(endpoint: EndpointHealthDetail, locale: Locale = defaultLocale): string {
|
||||
const format = endpoint.api_format
|
||||
const format = formatApiFormat(endpoint.api_format)
|
||||
const status = getEndpointStatus(endpoint)
|
||||
const t = (value: string) => translateLegacyText(value, locale)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user