Update common.ts

This commit is contained in:
Richard C Lim 2025-02-02 04:03:56 -05:00 committed by GitHub
parent 342f7b17c1
commit 22da0d4bfc
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -55,10 +55,6 @@ const isAzure = req.nextUrl.pathname.includes("azure/deployments") || Boolean(se
req?.nextUrl?.searchParams?.get("api-version") || req?.nextUrl?.searchParams?.get("api-version") ||
serverConfig.azureApiVersion; serverConfig.azureApiVersion;
baseUrl = baseUrl.split("/deployments").shift() as string; baseUrl = baseUrl.split("/deployments").shift() as string;
path = `${req.nextUrl.pathname.replaceAll(
"/api/azure/",
"",
)}?api-version=${azureApiVersion}`;
// Forward compatibility: // Forward compatibility:
// if display_name(deployment_name) not set, and '{deploy-id}' in AZURE_URL // if display_name(deployment_name) not set, and '{deploy-id}' in AZURE_URL
@ -89,7 +85,7 @@ const isAzure = req.nextUrl.pathname.includes("azure/deployments") || Boolean(se
} }
} }
const fetchUrl = cloudflareAIGatewayUrl(`${baseUrl}`); const fetchUrl = cloudflareAIGatewayUrl(`${baseUrl}/${path}`);
console.log("fetchUrl", fetchUrl); console.log("fetchUrl", fetchUrl);
const fetchOptions: RequestInit = { const fetchOptions: RequestInit = {
headers: { headers: {