fix: fallback and auth issues when configuring a duplicate model id

This commit is contained in:
mingholy.lmh 2026-01-07 20:05:33 +08:00
parent afe6ba255e
commit ded1ebcdff
4 changed files with 47 additions and 49 deletions

View file

@ -66,12 +66,14 @@ function hasApiKeyForAuth(
const defaultEnvKey = DEFAULT_ENV_KEYS[authType];
if (defaultEnvKey) {
const hasKey = !!process.env[defaultEnvKey];
return { hasKey, checkedEnvKey: defaultEnvKey };
if (hasKey) {
return { hasKey, checkedEnvKey: defaultEnvKey };
}
}
// Also check settings.security.auth.apiKey as fallback
if (settings.security?.auth?.apiKey) {
return { hasKey: true, checkedEnvKey: undefined };
return { hasKey: true, checkedEnvKey: defaultEnvKey || undefined };
}
return { hasKey: false, checkedEnvKey: undefined };