mirror of
https://github.com/fawney19/Aether.git
synced 2026-10-04 16:37:46 +08:00
Merge pull request #545 from RWDai/feat/expand-client-types
feat: expand client type recognition
This commit is contained in:
@@ -889,6 +889,7 @@ import {
|
||||
} from '../utils/status'
|
||||
import { useRowClick } from '@/composables/useRowClick'
|
||||
import { formatApiFormat } from '@/api/endpoints/types/api-format'
|
||||
import { formatClientFamily } from '@/features/usage/utils/clientFamily'
|
||||
import type { DateRangeParams, UsageRecord } from '../types'
|
||||
import { MultiSelect, TimeRangePicker } from '@/components/common'
|
||||
import type { MultiSelectOption } from '@/components/common/MultiSelect.vue'
|
||||
@@ -1112,19 +1113,6 @@ const providerFilterOptions = computed<FilterOption[]>(() => [
|
||||
})),
|
||||
])
|
||||
|
||||
function formatClientFamily(value: string | null | undefined): string {
|
||||
const normalized = value?.trim().toLowerCase()
|
||||
if (!normalized) return '-'
|
||||
if (normalized === 'codex') return 'Codex'
|
||||
if (normalized === 'codex_vscode') return 'Codex VS Code'
|
||||
if (normalized === 'claude_code') return 'Claude Code'
|
||||
if (normalized === 'opencode') return 'OpenCode'
|
||||
if (normalized === 'gemini_cli') return 'Gemini CLI'
|
||||
if (normalized === 'openai_js_sdk') return 'OpenAI JS SDK'
|
||||
if (normalized === 'generic') return '通用客户端'
|
||||
return value?.trim() || '-'
|
||||
}
|
||||
|
||||
const clientFamilyFilterOptions = computed<FilterOption[]>(() => {
|
||||
const families = new Set<string>(props.availableClientFamilies)
|
||||
props.records.forEach((record) => {
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
import { describe, expect, it } from 'vitest'
|
||||
import { formatClientFamily } from '../clientFamily'
|
||||
|
||||
describe('formatClientFamily', () => {
|
||||
it('labels supported clients and SDKs', () => {
|
||||
expect(formatClientFamily('qwen_code')).toBe('Qwen Code')
|
||||
expect(formatClientFamily('roo_code')).toBe('Roo Code')
|
||||
expect(formatClientFamily('kilocode')).toBe('KiloCode')
|
||||
expect(formatClientFamily('cherrystudio')).toBe('Cherry Studio')
|
||||
expect(formatClientFamily('openui')).toBe('OpenUI')
|
||||
expect(formatClientFamily('openai_python_sdk')).toBe('OpenAI Python SDK')
|
||||
expect(formatClientFamily('anthropic_js_sdk')).toBe('Anthropic JS SDK')
|
||||
})
|
||||
|
||||
it('renders unrecognized families as unknown', () => {
|
||||
expect(formatClientFamily(null)).toBe('unknown')
|
||||
expect(formatClientFamily('')).toBe('unknown')
|
||||
expect(formatClientFamily('custom-client')).toBe('unknown')
|
||||
})
|
||||
})
|
||||
@@ -0,0 +1,29 @@
|
||||
export function formatClientFamily(value: string | null | undefined): string {
|
||||
const normalized = value?.trim().toLowerCase()
|
||||
if (!normalized) return 'unknown'
|
||||
if (normalized === 'codex') return 'Codex'
|
||||
if (normalized === 'codex_vscode') return 'Codex VS Code'
|
||||
if (normalized === 'claude_code') return 'Claude Code'
|
||||
if (normalized === 'opencode') return 'OpenCode'
|
||||
if (normalized === 'gemini_cli') return 'Gemini CLI'
|
||||
if (normalized === 'openai_js_sdk') return 'OpenAI JS SDK'
|
||||
if (normalized === 'openai_python_sdk') return 'OpenAI Python SDK'
|
||||
if (normalized === 'anthropic_js_sdk') return 'Anthropic JS SDK'
|
||||
if (normalized === 'anthropic_python_sdk') return 'Anthropic Python SDK'
|
||||
if (normalized === 'qwen_code') return 'Qwen Code'
|
||||
if (normalized === 'roo_code') return 'Roo Code'
|
||||
if (normalized === 'kilocode') return 'KiloCode'
|
||||
if (normalized === 'cherrystudio') return 'Cherry Studio'
|
||||
if (normalized === 'openui') return 'OpenUI'
|
||||
if (normalized === 'cursor') return 'Cursor'
|
||||
if (normalized === 'windsurf') return 'Windsurf'
|
||||
if (normalized === 'continue') return 'Continue'
|
||||
if (normalized === 'cline') return 'Cline'
|
||||
if (normalized === 'aider') return 'Aider'
|
||||
if (normalized === 'langchain') return 'LangChain'
|
||||
if (normalized === 'llamaindex') return 'LlamaIndex'
|
||||
if (normalized === 'sdk') return 'SDK'
|
||||
if (normalized === 'generic') return 'generic'
|
||||
if (normalized === 'unknown') return 'unknown'
|
||||
return 'unknown'
|
||||
}
|
||||
Reference in New Issue
Block a user