fix(profile): handle km compatibility for legacy kimi api users

This commit is contained in:
Tam Nhu Tran
2026-02-19 12:43:41 +07:00
parent 7efbac6c1a
commit cf8070b5f0
17 changed files with 266 additions and 54 deletions
+6 -1
View File
@@ -26,6 +26,9 @@ export interface ProviderPreset {
}
export const OPENROUTER_BASE_URL = 'https://openrouter.ai/api';
const LEGACY_PRESET_ALIASES: Readonly<Record<string, string>> = Object.freeze({
kimi: 'km',
});
/**
* Provider presets available via CLI and UI
@@ -169,7 +172,9 @@ export const PROVIDER_PRESETS: ProviderPreset[] = [
/** Get preset by ID */
export function getPresetById(id: string): ProviderPreset | undefined {
return PROVIDER_PRESETS.find((p) => p.id === id.toLowerCase());
const normalized = id.toLowerCase();
const canonical = LEGACY_PRESET_ALIASES[normalized] || normalized;
return PROVIDER_PRESETS.find((p) => p.id === canonical);
}
/** Get all preset IDs */