mirror of
https://github.com/Nezumi-2711/9router.git
synced 2026-09-23 04:09:49 +00:00
fix: update the logic code for combos pages
This commit is contained in:
@@ -111,17 +111,21 @@ export async function POST(request) {
|
||||
// Dual-auth providers (e.g. codebuddy-cn, xai) live under category "oauth" but also
|
||||
// accept an API key via authModes — they aren't in APIKEY_PROVIDERS, so allow them here.
|
||||
const supportsApiKeyMode = !!AI_PROVIDERS[provider]?.authModes?.includes("apikey");
|
||||
const isCompatibleProvider = isOpenAICompatibleProvider(provider)
|
||||
|| isAnthropicCompatibleProvider(provider)
|
||||
|| isCustomEmbeddingProvider(provider);
|
||||
const isValidProvider = APIKEY_PROVIDERS[provider] ||
|
||||
FREE_TIER_PROVIDERS[provider] ||
|
||||
supportsApiKeyMode ||
|
||||
isWebCookieProvider ||
|
||||
isOpenAICompatibleProvider(provider) ||
|
||||
isAnthropicCompatibleProvider(provider) ||
|
||||
isCustomEmbeddingProvider(provider);
|
||||
isCompatibleProvider;
|
||||
|
||||
if (!provider || !isValidProvider) {
|
||||
return NextResponse.json({ error: "Invalid provider" }, { status: 400 });
|
||||
}
|
||||
if (isCompatibleProvider && user.role !== "admin") {
|
||||
return NextResponse.json({ error: "Administrator access required" }, { status: 403 });
|
||||
}
|
||||
if (!apiKey && provider !== "ollama-local") {
|
||||
return NextResponse.json({ error: `${isWebCookieProvider ? "Cookie value" : "API Key"} is required` }, { status: 400 });
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user