mirror of
https://github.com/ChatGPTNextWeb/ChatGPT-Next-Web.git
synced 2025-09-28 06:06:38 +08:00
Update common.ts
This commit is contained in:
parent
e3e456e434
commit
7885ea7d9e
@ -56,9 +56,19 @@ const isAzure = req.nextUrl.pathname.includes("azure/deployments") || Boolean(se
|
|||||||
const isAIFoundation = baseUrl.includes(".models.ai.azure.com");
|
const isAIFoundation = baseUrl.includes(".models.ai.azure.com");
|
||||||
if (isAIFoundation) {
|
if (isAIFoundation) {
|
||||||
// For AI Foundation models, use direct path without deployments
|
// For AI Foundation models, use direct path without deployments
|
||||||
path = "chat/completions";
|
// failed to work. path = "chat/completions";
|
||||||
|
path = req.nextUrl.pathname
|
||||||
|
.replace("/api/azure/openai/", "")
|
||||||
|
.replace("/deployments/", "")
|
||||||
|
.split("/")
|
||||||
|
.slice(-2)
|
||||||
|
.join("/");
|
||||||
} else {
|
} else {
|
||||||
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
|
||||||
|
Loading…
Reference in New Issue
Block a user