mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 16:11:36 +00:00
refactor(model): share normalized provider map lookups
This commit is contained in:
@@ -10,7 +10,7 @@ import {
|
||||
resolveAuthProfileOrder,
|
||||
resolveEnvApiKey,
|
||||
} from "../../agents/model-auth.js";
|
||||
import { normalizeProviderId } from "../../agents/model-selection.js";
|
||||
import { findNormalizedProviderValue, normalizeProviderId } from "../../agents/model-selection.js";
|
||||
import { shortenHomePath } from "../../utils.js";
|
||||
|
||||
export type ModelAuthDetailMode = "compact" | "verbose";
|
||||
@@ -39,18 +39,7 @@ export const resolveAuthLabel = async (
|
||||
});
|
||||
const order = resolveAuthProfileOrder({ cfg, store, provider });
|
||||
const providerKey = normalizeProviderId(provider);
|
||||
const lastGood = (() => {
|
||||
const map = store.lastGood;
|
||||
if (!map) {
|
||||
return undefined;
|
||||
}
|
||||
for (const [key, value] of Object.entries(map)) {
|
||||
if (normalizeProviderId(key) === providerKey) {
|
||||
return value;
|
||||
}
|
||||
}
|
||||
return undefined;
|
||||
})();
|
||||
const lastGood = findNormalizedProviderValue(store.lastGood, providerKey);
|
||||
const nextProfileId = order[0];
|
||||
const now = Date.now();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user