mirror of
https://github.com/diegosouzapw/OmniRoute.git
synced 2026-08-22 23:22:09 +03:00
Cherry-picked the value commit (0e918816) onto the current tip, dropping the stale base-red sync commits. Focused tests: pollinations-api-key-required 1/1 plus the whole optional-key suite 142/142 (two legacy assertions in provider-route-schemas flipped to the new key-required contract, commented with the PR). Fixes #11096 — Pollinations answers 401 anonymously now. Thank you @rqzbeh!
This commit is contained in:
@@ -5692,8 +5692,8 @@
|
||||
"aggregatorsGateways": "Aggregators Gateways",
|
||||
"enterpriseCloud": "Enterprise & Cloud",
|
||||
"apiFormatLabel": "Api Format Label",
|
||||
"apiKeyOptionalHint": "Api Key Optional Hint",
|
||||
"apiKeyOptionalLabel": "Api Key Optional Label",
|
||||
"apiKeyOptionalHint": "Leave empty if your local setup or provider does not require authentication.",
|
||||
"apiKeyOptionalLabel": "API Key (optional)",
|
||||
"apiRegionChina": "Api Region China",
|
||||
"apiRegionHint": "Api Region Hint",
|
||||
"apiRegionInternational": "Api Region International",
|
||||
|
||||
@@ -237,7 +237,6 @@ export function isSelfHostedChatProvider(providerId: unknown): boolean {
|
||||
const EXPLICIT_OPTIONAL_APIKEY_PROVIDER_IDS = new Set([
|
||||
"searxng-search",
|
||||
"firecrawl",
|
||||
"pollinations",
|
||||
"copilot-web",
|
||||
"hackclub",
|
||||
"g4f-groq",
|
||||
|
||||
11
tests/unit/pollinations-api-key-required-11096.test.ts
Normal file
11
tests/unit/pollinations-api-key-required-11096.test.ts
Normal file
@@ -0,0 +1,11 @@
|
||||
import test from "node:test";
|
||||
import assert from "node:assert/strict";
|
||||
import { providerAllowsOptionalApiKey } from "../../src/shared/constants/providers.js";
|
||||
|
||||
test("pollinations provider requires an API key and does not allow optional API key", () => {
|
||||
assert.equal(
|
||||
providerAllowsOptionalApiKey("pollinations"),
|
||||
false,
|
||||
"pollinations must require an API key because anonymous completions are no longer supported"
|
||||
);
|
||||
});
|
||||
@@ -5,17 +5,19 @@ const { createProviderSchema, providersBatchTestSchema } =
|
||||
await import("../../src/shared/validation/schemas.ts");
|
||||
const { providerAllowsOptionalApiKey } = await import("../../src/shared/constants/providers.ts");
|
||||
|
||||
test("Pollinations is treated as a keyless-capable provider", () => {
|
||||
assert.equal(providerAllowsOptionalApiKey("pollinations"), true);
|
||||
// #11117: Pollinations no longer serves anonymous requests (401 without a key),
|
||||
// so it left EXPLICIT_OPTIONAL_APIKEY_PROVIDER_IDS — key is now required.
|
||||
test("Pollinations requires an API key", () => {
|
||||
assert.equal(providerAllowsOptionalApiKey("pollinations"), false);
|
||||
});
|
||||
|
||||
test("createProviderSchema allows Pollinations without apiKey", () => {
|
||||
test("createProviderSchema rejects Pollinations without apiKey", () => {
|
||||
const result = createProviderSchema.safeParse({
|
||||
provider: "pollinations",
|
||||
name: "Pollinations",
|
||||
});
|
||||
|
||||
assert.equal(result.success, true);
|
||||
assert.equal(result.success, false);
|
||||
});
|
||||
|
||||
test("providersBatchTestSchema accepts cloud-agent batch mode", () => {
|
||||
|
||||
Reference in New Issue
Block a user