refactor(model): share normalized provider map lookups

This commit is contained in:
Peter Steinberger
2026-02-16 22:58:23 +00:00
parent 1fca7c3928
commit 9f0fc74d10
5 changed files with 43 additions and 58 deletions

View File

@@ -1,7 +1,7 @@
import type { OpenClawConfig } from "../../config/config.js";
import type { AuthProfileConfig } from "../../config/types.js";
import type { AuthProfileIdRepairResult, AuthProfileStore } from "./types.js";
import { normalizeProviderId } from "../model-selection.js";
import { findNormalizedProviderKey, normalizeProviderId } from "../model-selection.js";
import { dedupeProfileIds, listProfilesForProvider } from "./profiles.js";
function getProfileSuffix(profileId: string): string {
@@ -128,7 +128,7 @@ export function repairOAuthProfileIdMismatch(params: {
if (!order) {
return undefined;
}
const resolvedKey = Object.keys(order).find((key) => normalizeProviderId(key) === providerKey);
const resolvedKey = findNormalizedProviderKey(order, providerKey);
if (!resolvedKey) {
return order;
}