fix(ai): Restore original api contract for getEnvApiKey

This commit is contained in:
Armin Ronacher
2026-04-23 22:04:25 +02:00
parent 2394f3a987
commit 0cb8ff3843
3 changed files with 90 additions and 103 deletions

View File

@@ -7,8 +7,9 @@
*/
import {
findEnvKeys,
getEnvApiKey,
getEnvApiKeyInfo,
hasEnvAuth,
type OAuthCredentials,
type OAuthLoginCallbacks,
type OAuthProviderId,
@@ -331,7 +332,7 @@ export class AuthStorage {
hasAuth(provider: string): boolean {
if (this.runtimeOverrides.has(provider)) return true;
if (this.data[provider]) return true;
if (getEnvApiKey(provider)) return true;
if (hasEnvAuth(provider)) return true;
if (this.fallbackResolver?.(provider)) return true;
return false;
}
@@ -348,9 +349,9 @@ export class AuthStorage {
return { configured: false, source: "runtime", label: "--api-key" };
}
const envKey = getEnvApiKeyInfo(provider);
if (envKey) {
return { configured: false, source: "environment", label: envKey.label };
const envKeys = findEnvKeys(provider);
if (envKeys?.[0]) {
return { configured: false, source: "environment", label: envKeys[0] };
}
if (this.fallbackResolver?.(provider)) {