Merge 002011527c8b70d3a72f9d05d82068146dd7caaf into 5bb5d7dab4b29e68b15bb7665d0736f46499a35c

This commit is contained in:
Tomi 2026-03-21 05:30:08 +00:00 committed by GitHub
commit d7d908c986
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -169,6 +169,18 @@ function resolveSyntheticLocalProviderAuth(params: {
cfg: OpenClawConfig | undefined;
provider: string;
}): ResolvedProviderAuth | null {
// Check for known local providers first — these should always get synthetic auth,
// even when the user sets models.primary without running the provider setup wizard
// (i.e., no explicit models.providers.{name} config entry exists).
const normalizedProvider = normalizeProviderId(params.provider);
if (normalizedProvider === "ollama") {
return {
apiKey: OLLAMA_LOCAL_AUTH_MARKER,
source: "models.providers.ollama (synthetic local key)",
mode: "api-key",
};
}
const providerConfig = resolveProviderConfig(params.cfg, params.provider);
if (!providerConfig) {
return null;
@ -182,15 +194,6 @@ function resolveSyntheticLocalProviderAuth(params: {
return null;
}
const normalizedProvider = normalizeProviderId(params.provider);
if (normalizedProvider === "ollama") {
return {
apiKey: OLLAMA_LOCAL_AUTH_MARKER,
source: "models.providers.ollama (synthetic local key)",
mode: "api-key",
};
}
const authOverride = resolveProviderAuthOverride(params.cfg, params.provider);
if (authOverride && authOverride !== "api-key") {
return null;