mirror of
https://github.com/wu736139669/hapi.git
synced 2026-10-11 19:50:05 +00:00
66 lines
2.7 KiB
TypeScript
66 lines
2.7 KiB
TypeScript
export const CLAUDE_MODEL_LABELS = {
|
|
sonnet: 'Sonnet',
|
|
'sonnet[1m]': 'Sonnet 1M',
|
|
opus: 'Opus',
|
|
'opus[1m]': 'Opus 1M',
|
|
fable: 'Fable',
|
|
'fable[1m]': 'Fable 1M'
|
|
} as const
|
|
|
|
export type ClaudeModelPreset = keyof typeof CLAUDE_MODEL_LABELS
|
|
export const CLAUDE_MODEL_PRESETS = Object.keys(CLAUDE_MODEL_LABELS) as ClaudeModelPreset[]
|
|
|
|
export const GEMINI_MODEL_LABELS = {
|
|
'gemini-3.1-pro-preview': 'Gemini 3.1 Pro Preview',
|
|
'gemini-3-flash-preview': 'Gemini 3 Flash Preview',
|
|
'gemini-2.5-pro': 'Gemini 2.5 Pro',
|
|
'gemini-2.5-flash': 'Gemini 2.5 Flash',
|
|
'gemini-2.5-flash-lite': 'Gemini 2.5 Flash Lite',
|
|
} as const
|
|
|
|
export type GeminiModelPreset = keyof typeof GEMINI_MODEL_LABELS
|
|
export const GEMINI_MODEL_PRESETS = Object.keys(GEMINI_MODEL_LABELS) as GeminiModelPreset[]
|
|
export const DEFAULT_GEMINI_MODEL: GeminiModelPreset = 'gemini-2.5-pro'
|
|
|
|
// Order and labels mirror `agy models` output (the agy CLI's own listing) so the
|
|
// HAPI picker matches what users see in the terminal. IDs follow agy's
|
|
// `<model>-<effort>` convention (e.g. `gemini-3.5-flash-low` verified accepted by
|
|
// `agy --model`). NOTE: agy fetches the live list server-side and `agy models`
|
|
// needs an interactive keyring unlock, so this stays a hand-maintained mirror —
|
|
// update it when agy's listing changes.
|
|
export const AGY_MODEL_LABELS = {
|
|
'gemini-3.6-flash-high': 'Gemini 3.6 Flash (High)',
|
|
'gemini-3.6-flash-medium': 'Gemini 3.6 Flash (Medium)',
|
|
'gemini-3.6-flash-low': 'Gemini 3.6 Flash (Low)',
|
|
'gemini-3.5-flash-medium': 'Gemini 3.5 Flash (Medium)',
|
|
'gemini-3.5-flash-high': 'Gemini 3.5 Flash (High)',
|
|
'gemini-3.5-flash-low': 'Gemini 3.5 Flash (Low)',
|
|
'gemini-3.1-pro-low': 'Gemini 3.1 Pro (Low)',
|
|
'gemini-3.1-pro-high': 'Gemini 3.1 Pro (High)',
|
|
'claude-sonnet-4-6': 'Claude Sonnet 4.6 (Thinking)',
|
|
'claude-opus-4-6-thinking': 'Claude Opus 4.6 (Thinking)',
|
|
'gpt-oss-120b-medium': 'GPT-OSS 120B (Medium)',
|
|
} as const
|
|
|
|
export type AgyModelPreset = keyof typeof AGY_MODEL_LABELS
|
|
export const AGY_MODEL_PRESETS = Object.keys(AGY_MODEL_LABELS) as AgyModelPreset[]
|
|
|
|
export function getAgyModelLabel(model: string): string | null {
|
|
const trimmedModel = model.trim()
|
|
if (!trimmedModel) return null
|
|
return AGY_MODEL_LABELS[trimmedModel as AgyModelPreset] ?? null
|
|
}
|
|
|
|
export function isClaudeModelPreset(model: string | null | undefined): model is ClaudeModelPreset {
|
|
return typeof model === 'string' && Object.hasOwn(CLAUDE_MODEL_LABELS, model)
|
|
}
|
|
|
|
export function getClaudeModelLabel(model: string): string | null {
|
|
const trimmedModel = model.trim()
|
|
if (!trimmedModel) {
|
|
return null
|
|
}
|
|
|
|
return CLAUDE_MODEL_LABELS[trimmedModel as ClaudeModelPreset] ?? null
|
|
}
|