fix ts type error
This commit is contained in:
parent
93a03f8fe4
commit
147fc9a35a
|
@ -102,8 +102,8 @@ async function request(req: NextRequest) {
|
||||||
);
|
);
|
||||||
|
|
||||||
const { access_token } = await getAccessToken(
|
const { access_token } = await getAccessToken(
|
||||||
serverConfig.baiduApiKey,
|
serverConfig.baiduApiKey as string,
|
||||||
serverConfig.baiduSecretKey,
|
serverConfig.baiduSecretKey as string,
|
||||||
);
|
);
|
||||||
const fetchUrl = `${baseUrl}${path}?access_token=${access_token}`;
|
const fetchUrl = `${baseUrl}${path}?access_token=${access_token}`;
|
||||||
|
|
||||||
|
|
|
@ -70,7 +70,7 @@ export async function requestOpenai(req: NextRequest) {
|
||||||
// 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}'
|
||||||
if (serverConfig.customModels) {
|
if (serverConfig.customModels && serverConfig.azureUrl) {
|
||||||
const modelName = path.split("/")[1];
|
const modelName = path.split("/")[1];
|
||||||
let realDeployName = "";
|
let realDeployName = "";
|
||||||
serverConfig.customModels
|
serverConfig.customModels
|
||||||
|
@ -80,7 +80,9 @@ export async function requestOpenai(req: NextRequest) {
|
||||||
const [fullName, displayName] = m.split("=");
|
const [fullName, displayName] = m.split("=");
|
||||||
const [_, providerName] = fullName.split("@");
|
const [_, providerName] = fullName.split("@");
|
||||||
if (providerName === "azure" && !displayName) {
|
if (providerName === "azure" && !displayName) {
|
||||||
const [_, deployId] = serverConfig.azureUrl.split("deployments/");
|
const [_, deployId] = (serverConfig?.azureUrl ?? "").split(
|
||||||
|
"deployments/",
|
||||||
|
);
|
||||||
if (deployId) {
|
if (deployId) {
|
||||||
realDeployName = deployId;
|
realDeployName = deployId;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue