/** * Model Display Names Utility * * Maps internal model identifiers to user-friendly display names. * Handles various naming conventions and aliases. */ const CEREBRAS_MODEL_ID = 'qwen/qwen3-235b-a22b-thinking-2507'; const CEREBRAS_LEGACY_MODEL_ID = 'qwen-3-235b-a22b-thinking-2507'; const CEREBRAS_MODEL_DISPLAY = 'Cerebras - Qwen 3 Thinking'; export const MODEL_DISPLAY_NAMES: Readonly> = Object.freeze({ 'cerebras': CEREBRAS_MODEL_DISPLAY, 'cerebras-primary': CEREBRAS_MODEL_DISPLAY, 'cerebras-secondary': CEREBRAS_MODEL_DISPLAY, [CEREBRAS_MODEL_ID]: CEREBRAS_MODEL_DISPLAY, [CEREBRAS_LEGACY_MODEL_ID]: CEREBRAS_MODEL_DISPLAY, 'claude': 'Claude', 'claude-primary': 'Claude', 'gemini': 'Gemini', 'gemini-2.5-flash': 'Gemini 2.5 Flash', 'perplexity': 'Perplexity Sonar', 'perplexity-sonar': 'Perplexity Sonar', 'sonar': 'Perplexity Sonar', 'sonar-pro': 'Perplexity Sonar Pro', 'grok': 'Grok 3', 'grok-3': 'Grok 3', 'openai': 'OpenAI GPT-4o', 'gpt-4o': 'OpenAI GPT-4o', 'gpt-5': 'OpenAI GPT-4o', 'multi-model-synthesis': 'Multi-Model Synthesis', 'step2-final-synthesis': 'Multi-Model Synthesis', 'step1-primary': 'Primary Model' }); /** * Get user-friendly display name for a model * Handles various naming conventions (dashes, underscores, etc.) * * @param model - Internal model identifier * @returns User-friendly display name * * @example * ```typescript * getModelDisplayName('cerebras') // => 'Cerebras - Qwen 3 Thinking' * getModelDisplayName('claude-primary') // => 'Claude' * getModelDisplayName('grok_3') // => 'Grok 3' * ``` */ export function getModelDisplayName(model: string): string { if (!model) { return model; } const normalizedModel = model.toLowerCase(); const modelDashed = model.replace(/_/g, '-'); const normalizedModelDashed = normalizedModel.replace(/_/g, '-'); return ( MODEL_DISPLAY_NAMES[model] || MODEL_DISPLAY_NAMES[normalizedModel] || MODEL_DISPLAY_NAMES[modelDashed] || MODEL_DISPLAY_NAMES[normalizedModelDashed] || model ); } /** * Normalize model identifier to consistent format * Converts underscores to dashes and lowercases * * @param model - Model identifier * @returns Normalized model identifier * * @example * ```typescript * normalizeModelIdentifier('CLAUDE_PRIMARY') // => 'claude-primary' * normalizeModelIdentifier('Grok 3') // => 'grok-3' * ``` */ export function normalizeModelIdentifier(model: string): string { return model.toLowerCase().replace(/_/g, '-').replace(/\s+/g, '-'); } /** * Check if a model identifier is recognized * * @param model - Model identifier to check * @returns True if model is recognized * * @example * ```typescript * isRecognizedModel('claude') // => true * isRecognizedModel('unknown-model') // => false * ``` */ export function isRecognizedModel(model: string): boolean { const normalized = normalizeModelIdentifier(model); return Object.keys(MODEL_DISPLAY_NAMES).includes(normalized); } /** * Get all recognized model identifiers * * @returns Array of all recognized model identifiers */ export function getRecognizedModels(): string[] { return Object.keys(MODEL_DISPLAY_NAMES); }