Update common.ts

This commit is contained in:
Richard C Lim 2025-01-31 04:44:44 -05:00 committed by GitHub
parent 8040433c35
commit 104264cde7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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;
@ -87,6 +92,7 @@ export async function requestOpenai(req: NextRequest) {
}
}
}
}
const fetchUrl = cloudflareAIGatewayUrl(`${baseUrl}/${path}`);
console.log("fetchUrl", fetchUrl);