mirror of
https://github.com/fawney19/Aether.git
synced 2026-10-09 02:47:45 +08:00
fix(usage): unify OpenAI Live and WebSocket records
This commit is contained in:
@@ -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