mirror of
https://github.com/diegosouzapw/OmniRoute.git
synced 2026-07-31 12:22:14 +03:00
Treat DuckDuckGo web as no-auth provider
Mark duckduckgo-web in WEB_COOKIE_PROVIDERS with noAuth and include it in providerAllowsOptionalApiKey. Update getProviderCredentials to check both NOAUTH_PROVIDERS and WEB_COOKIE_PROVIDERS for noAuth providers (returning synthetic credentials) and import WEB_COOKIE_PROVIDERS accordingly. This enables anonymous/anonymous-cookie web providers to be handled without DB lookups.
This commit is contained in:
committed by
diegosouzapw
parent
029e4f6943
commit
2ec803bbad
@@ -427,6 +427,7 @@ export const WEB_COOKIE_PROVIDERS = {
|
||||
textIcon: "DDG",
|
||||
website: "https://duckduckgo.com/duckchat",
|
||||
hasFree: true,
|
||||
noAuth: true,
|
||||
freeNote: "Free — anonymous access to multiple AI models via DuckDuckGo.",
|
||||
authHint: "No credentials required — DuckDuckGo AI Chat is anonymous and free.",
|
||||
},
|
||||
@@ -2892,6 +2893,7 @@ export function providerAllowsOptionalApiKey(providerId: unknown): boolean {
|
||||
providerId === "petals" ||
|
||||
providerId === "pollinations" ||
|
||||
providerId === "copilot-web" ||
|
||||
providerId === "duckduckgo-web" ||
|
||||
providerId === "veoaifree-web" ||
|
||||
providerId === "hackclub" ||
|
||||
providerId === "huggingchat" ||
|
||||
|
||||
@@ -47,6 +47,7 @@ import {
|
||||
getProviderAlias,
|
||||
resolveProviderId,
|
||||
NOAUTH_PROVIDERS,
|
||||
WEB_COOKIE_PROVIDERS,
|
||||
} from "@/shared/constants/providers";
|
||||
import { isModelExcludedByConnection } from "@/domain/connectionModelRules";
|
||||
import * as log from "../utils/logger";
|
||||
@@ -825,9 +826,11 @@ export async function getProviderCredentials(
|
||||
// No-auth providers (e.g. opencode) need no DB connection — return synthetic credentials
|
||||
// so the executor receives a valid credentials object without auth headers being added.
|
||||
const resolvedId = resolveProviderId(provider);
|
||||
if (
|
||||
(NOAUTH_PROVIDERS as Record<string, { noAuth?: boolean } | undefined>)[resolvedId]?.noAuth
|
||||
) {
|
||||
const providerMaps: Record<string, { noAuth?: boolean } | undefined>[] = [
|
||||
NOAUTH_PROVIDERS as Record<string, { noAuth?: boolean } | undefined>,
|
||||
WEB_COOKIE_PROVIDERS as Record<string, { noAuth?: boolean } | undefined>,
|
||||
];
|
||||
if (providerMaps.some((map) => map[resolvedId]?.noAuth)) {
|
||||
return {
|
||||
apiKey: null,
|
||||
accessToken: null,
|
||||
|
||||
Reference in New Issue
Block a user