mirror of
https://github.com/openclaw/openclaw.git
synced 2026-03-22 07:20:59 +00:00
fix(model): resolve openrouter/auto model lookup mismatch (#5395)
OpenRouter's 'auto' model is stored in the registry with the full id 'openrouter/auto', but parseModelRef splits 'openrouter/auto' into provider='openrouter' and modelId='auto'. The registry lookup then fails because it searches for id='auto' instead of 'openrouter/auto'. This adds a fallback that tries the full id when the initial lookup fails for this specific case.
This commit is contained in:
@@ -57,7 +57,14 @@ export function resolveModel(
|
||||
const resolvedAgentDir = agentDir ?? resolveOpenClawAgentDir();
|
||||
const authStorage = discoverAuthStorage(resolvedAgentDir);
|
||||
const modelRegistry = discoverModels(authStorage, resolvedAgentDir);
|
||||
const model = modelRegistry.find(provider, modelId) as Model<Api> | null;
|
||||
let model = modelRegistry.find(provider, modelId) as Model<Api> | null;
|
||||
|
||||
// Fallback: OpenRouter's "auto" model is stored with full id "openrouter/auto"
|
||||
// but parseModelRef splits it into provider="openrouter", modelId="auto"
|
||||
if (!model && provider === "openrouter" && modelId === "auto") {
|
||||
model = modelRegistry.find(provider, "openrouter/auto") as Model<Api> | null;
|
||||
}
|
||||
|
||||
if (!model) {
|
||||
const providers = cfg?.models?.providers ?? {};
|
||||
const inlineModels = buildInlineProviderModels(providers);
|
||||
|
||||
Reference in New Issue
Block a user