mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-08 09:01:22 +00:00
refactor(model): share normalized provider map lookups
This commit is contained in:
@@ -12,7 +12,11 @@ import {
|
||||
import { describeFailoverError } from "../../agents/failover-error.js";
|
||||
import { getCustomProviderApiKey, resolveEnvApiKey } from "../../agents/model-auth.js";
|
||||
import { loadModelCatalog } from "../../agents/model-catalog.js";
|
||||
import { normalizeProviderId, parseModelRef } from "../../agents/model-selection.js";
|
||||
import {
|
||||
findNormalizedProviderValue,
|
||||
normalizeProviderId,
|
||||
parseModelRef,
|
||||
} from "../../agents/model-selection.js";
|
||||
import { runEmbeddedPiAgent } from "../../agents/pi-embedded.js";
|
||||
import { resolveDefaultAgentWorkspaceDir } from "../../agents/workspace.js";
|
||||
import {
|
||||
@@ -164,23 +168,10 @@ function buildProbeTargets(params: {
|
||||
|
||||
const profileIds = listProfilesForProvider(store, providerKey);
|
||||
const explicitOrder = (() => {
|
||||
const order = store.order;
|
||||
if (order) {
|
||||
for (const [key, value] of Object.entries(order)) {
|
||||
if (normalizeProviderId(key) === providerKey) {
|
||||
return value;
|
||||
}
|
||||
}
|
||||
}
|
||||
const cfgOrder = cfg?.auth?.order;
|
||||
if (cfgOrder) {
|
||||
for (const [key, value] of Object.entries(cfgOrder)) {
|
||||
if (normalizeProviderId(key) === providerKey) {
|
||||
return value;
|
||||
}
|
||||
}
|
||||
}
|
||||
return undefined;
|
||||
return (
|
||||
findNormalizedProviderValue(store.order, providerKey) ??
|
||||
findNormalizedProviderValue(cfg?.auth?.order, providerKey)
|
||||
);
|
||||
})();
|
||||
const allowedProfiles =
|
||||
explicitOrder && explicitOrder.length > 0
|
||||
|
||||
Reference in New Issue
Block a user