mirror of
https://github.com/ChatGPTNextWeb/ChatGPT-Next-Web.git
synced 2025-09-27 21:56:38 +08:00
Update openai.ts
This commit is contained in:
parent
5ce02fb933
commit
5a345ef4a9
@ -260,11 +260,12 @@ export class ChatGPTApi implements LLMApi {
|
|||||||
let chatPath = "";
|
let chatPath = "";
|
||||||
if (modelConfig.providerName === ServiceProvider.Azure) {
|
if (modelConfig.providerName === ServiceProvider.Azure) {
|
||||||
const isAIFoundation = useAccessStore.getState().azureUrl?.includes(".models.ai.azure.com");
|
const isAIFoundation = useAccessStore.getState().azureUrl?.includes(".models.ai.azure.com");
|
||||||
|
const azureUrl = useAccessStore.getState().azureUrl;
|
||||||
if (isAIFoundation) {
|
if (!azureUrl) {
|
||||||
// For AI Foundation, use the URL directly as the deployment name
|
throw new Error("Azure URL is not configured");
|
||||||
chatPath = this.path(Azure.ChatPath(useAccessStore.getState().azureUrl || "", ""));
|
}
|
||||||
} else {
|
const sanitizedAzureUrl = azureUrl.replace(/\/+$/, "");
|
||||||
|
chatPath = cloudflareAIGatewayUrl(`${sanitizedAzureUrl}/chat/completions`);
|
||||||
// find model, and get displayName as deployName
|
// find model, and get displayName as deployName
|
||||||
const { models: configModels, customModels: configCustomModels } =
|
const { models: configModels, customModels: configCustomModels } =
|
||||||
useAppConfig.getState();
|
useAppConfig.getState();
|
||||||
@ -283,13 +284,12 @@ export class ChatGPTApi implements LLMApi {
|
|||||||
model.name === modelConfig.model &&
|
model.name === modelConfig.model &&
|
||||||
model?.provider?.providerName === ServiceProvider.Azure,
|
model?.provider?.providerName === ServiceProvider.Azure,
|
||||||
);
|
);
|
||||||
chatPath = this.path(
|
/* chatPath = this.path(
|
||||||
(isDalle3 ? Azure.ImagePath : Azure.ChatPath)(
|
(isDalle3 ? Azure.ImagePath : Azure.ChatPath)(
|
||||||
(model?.displayName ?? model?.name) as string,
|
(model?.displayName ?? model?.name) as string,
|
||||||
useCustomConfig ? useAccessStore.getState().azureApiVersion : "",
|
useCustomConfig ? useAccessStore.getState().azureApiVersion : "",
|
||||||
),
|
),
|
||||||
);
|
);*/
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
chatPath = this.path(
|
chatPath = this.path(
|
||||||
isDalle3 ? OpenaiPath.ImagePath : OpenaiPath.ChatPath,
|
isDalle3 ? OpenaiPath.ImagePath : OpenaiPath.ChatPath,
|
||||||
|
Loading…
Reference in New Issue
Block a user