fix(profile): close km legacy kimi compatibility gaps

This commit is contained in:
Tam Nhu Tran
2026-02-19 13:02:56 +07:00
parent cf8070b5f0
commit 0bf00b23d9
9 changed files with 343 additions and 66 deletions
+4 -5
View File
@@ -5,6 +5,8 @@
* Mirrors the UI presets in ui/src/lib/provider-presets.ts
*/
import { resolveAliasToCanonical } from '../../utils/profile-compat';
export type PresetCategory = 'recommended' | 'alternative';
export interface ProviderPreset {
@@ -26,9 +28,6 @@ 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
@@ -172,8 +171,8 @@ export const PROVIDER_PRESETS: ProviderPreset[] = [
/** Get preset by ID */
export function getPresetById(id: string): ProviderPreset | undefined {
const normalized = id.toLowerCase();
const canonical = LEGACY_PRESET_ALIASES[normalized] || normalized;
const normalized = id.trim().toLowerCase();
const canonical = resolveAliasToCanonical(normalized).toLowerCase();
return PROVIDER_PRESETS.find((p) => p.id === canonical);
}