mirror of
https://github.com/diegosouzapw/OmniRoute.git
synced 2026-08-04 14:22:09 +03:00
Merge branch 'main' resolving upstream conflicts (#2408)
Integrated into release/v3.8.0
This commit is contained in:
@@ -1,12 +1,15 @@
|
||||
import { getModelAliases, setModelAlias } from "@/lib/db/models";
|
||||
|
||||
export const DEFAULT_MODEL_ALIAS_SEED = Object.freeze({
|
||||
"gemini-3-pro-high": "antigravity/gemini-3-pro-preview",
|
||||
"gemini-3-pro-low": "antigravity/gemini-3.1-pro-low",
|
||||
"gemini-3-pro-preview": "antigravity/gemini-3-pro-preview",
|
||||
"gemini-3.1-pro-preview": "antigravity/gemini-3-pro-preview",
|
||||
"gemini-3.1-pro-preview-customtools": "antigravity/gemini-3-pro-preview",
|
||||
"gemini-3-flash-preview": "antigravity/gemini-3-flash-preview",
|
||||
"gemini-1.5-pro": "gemini-cli/gemini-1.5-pro",
|
||||
"gemini-1.5-flash": "gemini-cli/gemini-1.5-flash",
|
||||
"gemini-3-pro-high": "gemini-cli/gemini-3.1-pro-preview",
|
||||
"gemini-3-pro-low": "gemini-cli/gemini-3.1-flash-lite-preview",
|
||||
"gemini-3-pro-preview": "gemini-cli/gemini-3.1-pro-preview",
|
||||
"gemini-3.1-pro-preview": "gemini-cli/gemini-3.1-pro-preview",
|
||||
"gemini-3.1-pro-preview-customtools": "gemini-cli/gemini-3.1-pro-preview-customtools",
|
||||
"gemini-3-flash-preview": "gemini-cli/gemini-3-flash-preview",
|
||||
"gemini-3.1-flash-lite-preview": "gemini-cli/gemini-3.1-flash-lite-preview",
|
||||
});
|
||||
|
||||
type SeedLogger = {
|
||||
|
||||
@@ -732,14 +732,31 @@ async function validateGeminiLikeProvider({
|
||||
isLocal = false,
|
||||
}: any) {
|
||||
try {
|
||||
if (!baseUrl) {
|
||||
return { valid: false, error: "Missing base URL" };
|
||||
}
|
||||
|
||||
const requestUrl =
|
||||
typeof providerSpecificData?.modelsUrl === "string" &&
|
||||
providerSpecificData.modelsUrl.trim() !== ""
|
||||
? providerSpecificData.modelsUrl.trim()
|
||||
: `${baseUrl}/models`;
|
||||
|
||||
const urlWithKey =
|
||||
authType === "query" ? `${requestUrl}?key=${encodeURIComponent(apiKey)}` : requestUrl;
|
||||
const headers = authType === "header" ? { "x-goog-api-key": apiKey } : {};
|
||||
|
||||
// Use the correct auth header based on provider config:
|
||||
// - gemini / gemini-cli (API key): x-goog-api-key
|
||||
// - gemini-cli (OAuth): Bearer token
|
||||
const headers: Record<string, string> = {};
|
||||
|
||||
if (authType === "header" || authType === "apikey") {
|
||||
headers["x-goog-api-key"] = apiKey;
|
||||
} else if (authType === "oauth" || apiKey.startsWith("ya29.")) {
|
||||
headers["Authorization"] = `Bearer ${apiKey}`;
|
||||
}
|
||||
|
||||
applyCustomUserAgent(headers, providerSpecificData);
|
||||
|
||||
const response = await validationRead(
|
||||
urlWithKey,
|
||||
@@ -749,10 +766,6 @@ async function validateGeminiLikeProvider({
|
||||
isLocal
|
||||
);
|
||||
|
||||
if (!baseUrl) {
|
||||
return { valid: false, error: "Missing base URL" };
|
||||
}
|
||||
|
||||
if (response.ok) {
|
||||
return { valid: true, error: null };
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user