mirror of
https://github.com/ChatGPTNextWeb/ChatGPT-Next-Web.git
synced 2025-09-27 13:46:37 +08:00
Update common.ts
This commit is contained in:
parent
762f2cba5c
commit
06472adea9
@ -3,7 +3,6 @@ import { getServerSideConfig } from "../config/server";
|
|||||||
import { OPENAI_BASE_URL, ServiceProvider } from "../constant";
|
import { OPENAI_BASE_URL, ServiceProvider } from "../constant";
|
||||||
import { cloudflareAIGatewayUrl } from "../utils/cloudflare";
|
import { cloudflareAIGatewayUrl } from "../utils/cloudflare";
|
||||||
import { getModelProvider, isModelNotavailableInServer } from "../utils/model";
|
import { getModelProvider, isModelNotavailableInServer } from "../utils/model";
|
||||||
import { useChatStore } from "../store";
|
|
||||||
|
|
||||||
const serverConfig = getServerSideConfig();
|
const serverConfig = getServerSideConfig();
|
||||||
|
|
||||||
@ -58,10 +57,9 @@ console.log("[Auth Value Present]", !!authValue);
|
|||||||
const azureApiVersion =
|
const azureApiVersion =
|
||||||
req?.nextUrl?.searchParams?.get("api-version") ||
|
req?.nextUrl?.searchParams?.get("api-version") ||
|
||||||
serverConfig.azureApiVersion;
|
serverConfig.azureApiVersion;
|
||||||
const modelConfig = useChatStore.getState().currentSession().mask.modelConfig;
|
const isAIFoundation = baseUrl.includes(".models.ai.azure.com");
|
||||||
const deepSeek = modelConfig.model.includes("deekseek");
|
console.log("[Is AI Foundation]", isAIFoundation);
|
||||||
console.log("[Is AI deepSeek?]", deepSeek);
|
if (isAIFoundation) {
|
||||||
if (deepSeek) {
|
|
||||||
path = "chat/completions";
|
path = "chat/completions";
|
||||||
/* path = req.nextUrl.pathname
|
/* path = req.nextUrl.pathname
|
||||||
.replace("/api/azure/openai/", "")
|
.replace("/api/azure/openai/", "")
|
||||||
@ -77,6 +75,8 @@ console.log("[Auth Value Present]", !!authValue);
|
|||||||
"",
|
"",
|
||||||
)}?api-version=${azureApiVersion}`;
|
)}?api-version=${azureApiVersion}`;
|
||||||
console.log("[Azure OpenAI Path]", path);
|
console.log("[Azure OpenAI Path]", path);
|
||||||
|
}
|
||||||
|
|
||||||
// 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
|
||||||
// then using default '{deploy-id}'
|
// then using default '{deploy-id}'
|
||||||
@ -102,7 +102,6 @@ console.log("[Auth Value Present]", !!authValue);
|
|||||||
console.log("[Replace with DeployId", realDeployName);
|
console.log("[Replace with DeployId", realDeployName);
|
||||||
path = path.replaceAll(modelName, realDeployName);
|
path = path.replaceAll(modelName, realDeployName);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
console.log("[Final Path]", path);
|
console.log("[Final Path]", path);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user