From bbb82052e48c016aae4ec14a261065ea2680ca41 Mon Sep 17 00:00:00 2001 From: Danny Avila Date: Mon, 18 Mar 2024 19:28:36 -0400 Subject: [PATCH 1/2] fix(azure): fix regex to prevent edge cases --- api/app/clients/ChatGPTClient.js | 2 +- api/app/clients/OpenAIClient.js | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/api/app/clients/ChatGPTClient.js b/api/app/clients/ChatGPTClient.js index 802ba162d96..bac7849a15c 100644 --- a/api/app/clients/ChatGPTClient.js +++ b/api/app/clients/ChatGPTClient.js @@ -236,7 +236,7 @@ class ChatGPTClient extends BaseClient { baseURL: this.langchainProxy, azureOptions: this.azure, }) - : this.azureEndpoint.split(/\/(chat|completion)/)[0]; + : this.azureEndpoint.split(/(? Date: Mon, 18 Mar 2024 19:30:04 -0400 Subject: [PATCH 2/2] fix(assistants): pass relevant endpoint options to avoid sending them to API --- api/app/clients/OpenAIClient.js | 5 +++-- api/server/services/Endpoints/assistants/buildOptions.js | 3 ++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/api/app/clients/OpenAIClient.js b/api/app/clients/OpenAIClient.js index a81bce3ae95..bb4b5c6bb22 100644 --- a/api/app/clients/OpenAIClient.js +++ b/api/app/clients/OpenAIClient.js @@ -744,9 +744,10 @@ class OpenAIClient extends BaseClient { /** @type {TAzureConfig | undefined} */ const azureConfig = this.options?.req?.app?.locals?.[EModelEndpoint.azureOpenAI]; - const resetTitleOptions = + const resetTitleOptions = !!( (this.azure && azureConfig) || - (azureConfig && this.options.endpoint === EModelEndpoint.azureOpenAI); + (azureConfig && this.options.endpoint === EModelEndpoint.azureOpenAI) + ); if (resetTitleOptions) { const { modelGroupMap, groupMap } = azureConfig; diff --git a/api/server/services/Endpoints/assistants/buildOptions.js b/api/server/services/Endpoints/assistants/buildOptions.js index 4197d976bef..c670953539d 100644 --- a/api/server/services/Endpoints/assistants/buildOptions.js +++ b/api/server/services/Endpoints/assistants/buildOptions.js @@ -1,9 +1,10 @@ const buildOptions = (endpoint, parsedBody) => { // eslint-disable-next-line no-unused-vars - const { promptPrefix, chatGptLabel, resendImages, imageDetail, ...rest } = parsedBody; + const { promptPrefix, assistant_id, ...rest } = parsedBody; const endpointOption = { endpoint, promptPrefix, + assistant_id, modelOptions: { ...rest, },