From 104264cde77ba81a91c5bf7cc2e087411490beb0 Mon Sep 17 00:00:00 2001 From: Richard C Lim <61879224+richardclim@users.noreply.github.com> Date: Fri, 31 Jan 2025 04:44:44 -0500 Subject: [PATCH] Update common.ts --- app/api/common.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/app/api/common.ts b/app/api/common.ts index b7e41fa26..864f8870f 100644 --- a/app/api/common.ts +++ b/app/api/common.ts @@ -51,6 +51,11 @@ export async function requestOpenai(req: NextRequest) { ); if (isAzure) { + const isAIFoundation = serverConfig.azureUrl?.includes(".models.ai.azure.com"); + if (isAIFoundation) { + // For AI Foundation, use the path directly without api-version + path = req.nextUrl.pathname.replaceAll("/api/azure/", ""); + } else { const azureApiVersion = req?.nextUrl?.searchParams?.get("api-version") || serverConfig.azureApiVersion; @@ -85,6 +90,7 @@ export async function requestOpenai(req: NextRequest) { console.log("[Replace with DeployId", realDeployName); path = path.replaceAll(modelName, realDeployName); } + } } }