mirror of
https://github.com/fawney19/Aether.git
synced 2026-09-02 01:10:23 +08:00
refactor(api_format): 重构为结构化的 (ApiFamily, EndpointKind) 标识体系
将扁平的 APIFormat 枚举 (CLAUDE, OPENAI, GEMINI, *_CLI) 重构为二维结构: - ApiFamily: 协议族 (openai, claude, gemini) - EndpointKind: 端点变体 (chat, cli, video, image) 新增 EndpointSignature 数据类和 `family:kind` 签名键工具函数, 统一 JSON dict/metrics/logs 中的字符串标识格式。
This commit is contained in:
@@ -76,6 +76,7 @@ import TableRow from '@/components/ui/table-row.vue'
|
||||
import TableHead from '@/components/ui/table-head.vue'
|
||||
import TableCell from '@/components/ui/table-cell.vue'
|
||||
import { formatTokens, formatCurrency } from '@/utils/format'
|
||||
import { API_FORMAT_LABELS } from '@/api/endpoints/types'
|
||||
import type { ApiFormatStatsItem } from '../types'
|
||||
|
||||
defineProps<{
|
||||
@@ -85,15 +86,13 @@ defineProps<{
|
||||
|
||||
// 格式化 API 格式显示名称
|
||||
function formatApiFormat(format: string): string {
|
||||
const formatMap: Record<string, string> = {
|
||||
'CLAUDE': 'Claude',
|
||||
'CLAUDE_CLI': 'Claude CLI',
|
||||
'OPENAI': 'OpenAI',
|
||||
'OPENAI_CLI': 'OpenAI CLI',
|
||||
'GEMINI': 'Gemini',
|
||||
'GEMINI_CLI': 'Gemini CLI',
|
||||
}
|
||||
return formatMap[format.toUpperCase()] || format
|
||||
const raw = (format || '').trim()
|
||||
return (
|
||||
API_FORMAT_LABELS[raw] ||
|
||||
API_FORMAT_LABELS[raw.toLowerCase()] ||
|
||||
API_FORMAT_LABELS[raw.toUpperCase()] ||
|
||||
raw
|
||||
)
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user