Update openai.ts

This commit is contained in:
Richard C Lim 2025-02-01 18:07:14 -05:00 committed by GitHub
parent e0f6ffdec1
commit 82f75d9f41
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -93,15 +93,14 @@ export class ChatGPTApi implements LLMApi {
"incomplete azure config, please check it in your settings page", "incomplete azure config, please check it in your settings page",
); );
} }
baseUrl = isAzure ? accessStore.azureUrl : accessStore.openaiUrl; baseUrl = isAzure ? accessStore.azureUrl : accessStore.openaiUrl;
} }
if (baseUrl.length === 0) { if (baseUrl.length === 0) {
const isApp = !!getClientConfig()?.isApp; const isApp = !!getClientConfig()?.isApp;
const isAIFoundation = accessStore.azureUrl?.includes(".models.ai.azure.com"); const isAIFoundation = accessStore.azureUrl?.includes(".models.ai.azure.com");
if (isAzure && isAIFoundation) { if (isAIFoundation) {
baseUrl = accessStore.azureUrl || ""; baseUrl = accessStore.azureUrl;
} else { } else {
const apiPath = isAzure ? ApiPath.Azure : ApiPath.OpenAI; const apiPath = isAzure ? ApiPath.Azure : ApiPath.OpenAI;
baseUrl = isApp ? OPENAI_BASE_URL : apiPath; baseUrl = isApp ? OPENAI_BASE_URL : apiPath;