From 97b6eaa38a4944955dfd920e36a2cb1adf2e3000 Mon Sep 17 00:00:00 2001 From: Richard C Lim <61879224+richardclim@users.noreply.github.com> Date: Sun, 2 Feb 2025 17:50:25 -0500 Subject: [PATCH] Update common.ts --- app/api/common.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/app/api/common.ts b/app/api/common.ts index 1dd964ebc..2ec683f7b 100644 --- a/app/api/common.ts +++ b/app/api/common.ts @@ -49,6 +49,7 @@ const isAzure = req.nextUrl.pathname.includes("azure/deployments") || Boolean(se ); if (isAzure) { + console.log("[Original Path]", req.nextUrl.pathname); // Log initial path // const isAIFoundation = serverConfig.azureUrl?.includes(".models.ai.azure.com"); const azureApiVersion = req?.nextUrl?.searchParams?.get("api-version") || @@ -57,19 +58,21 @@ const isAzure = req.nextUrl.pathname.includes("azure/deployments") || Boolean(se if (isAIFoundation) { // For AI Foundation models, use direct path without deployments // failed to work. path = "chat/completions"; - path = req.nextUrl.pathname + path = "chat/completions"; + /* path = req.nextUrl.pathname .replace("/api/azure/openai/", "") .replace("/deployments/", "") .split("/") .slice(-2) .join("/"); + */ } else { baseUrl = baseUrl.split("/deployments").shift() as string; path = `${req.nextUrl.pathname.replaceAll( "/api/azure/", "", )}?api-version=${azureApiVersion}`; - + console.log("[Azure OpenAI Path]", path); // Forward compatibility: // if display_name(deployment_name) not set, and '{deploy-id}' in AZURE_URL // then using default '{deploy-id}'