fix: freeTier/apikey providers without authModes default to apikey in dualAuthTypes

Free-tier and apikey providers (e.g. cloudflare-ai, byteplus, ollama, vertex) whose registry entry omits authModes were treated as oauth-only, hiding their apikey connections on the providers grid card.
This commit is contained in:
techysy
2026-08-05 10:22:29 +07:00
committed by decolua
parent f260a1817b
commit 0e5da70cb1

View File

@@ -283,7 +283,15 @@ export default function ProvidersPage() {
const dualAuthTypes = (info, key) => {
if (key === "kiro") return ["oauth", "apikey", "api_key"];
const modes = info?.authModes;
if (!Array.isArray(modes) || !modes.includes("apikey")) return "oauth";
// Free-tier and API-key providers default to supporting apikey even when the
// registry entry omits authModes (e.g. cloudflare-ai, byteplus, ollama,
// vertex) — otherwise their apikey connections are invisible on the grid card.
if (!Array.isArray(modes)) {
return key in FREE_TIER_PROVIDERS || key in APIKEY_PROVIDERS
? ["oauth", "apikey", "api_key"]
: "oauth";
}
if (!modes.includes("apikey")) return "oauth";
return ["oauth", "apikey", "api_key"];
};