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
+17
View File
@@ -10,6 +10,23 @@ const PROFILE_COMPAT_ALIASES: Readonly<Record<string, readonly string[]>> = Obje
km: ['kimi'],
});
/**
* Resolve a legacy alias to its canonical profile name.
* Returns trimmed input when no alias mapping exists.
*/
export function resolveAliasToCanonical(profileName: string): string {
const raw = profileName.trim();
const normalized = raw.toLowerCase();
for (const [canonical, aliases] of Object.entries(PROFILE_COMPAT_ALIASES)) {
if (aliases.includes(normalized)) {
return canonical;
}
}
return raw;
}
/**
* Build lookup candidates for a profile.
* Order: exact input -> lowercase form (if different) -> legacy aliases.