Update openai.ts

This commit is contained in:
Richard C Lim 2025-02-01 04:52:50 -05:00 committed by GitHub
parent c5776ceb34
commit e0f6ffdec1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -99,9 +99,14 @@ export class ChatGPTApi implements LLMApi {
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");
if (isAzure && isAIFoundation) {
baseUrl = accessStore.azureUrl || "";
} 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;
} }
}
if (baseUrl.endsWith("/")) { if (baseUrl.endsWith("/")) {
baseUrl = baseUrl.slice(0, baseUrl.length - 1); baseUrl = baseUrl.slice(0, baseUrl.length - 1);