Skip to content

Enhanced ChatGPT Clone: Features Agents, MCP, Skills, DeepSeek, Anthropic, AWS, OpenAI, Responses API, Azure, Groq, o1, GPT-5, Mistral, OpenRouter, Vertex AI, Gemini, Artifacts, AI model switching, message search, Code Interpreter, langchain, DALL-E-3, OpenAPI Actions, Functions, Secure Multi-User Auth, Presets, open-source for self-hosting. Active

🪰 fix: Azure Parsing and Assistants Payload (#2133)

Danny Avilaf51ac74e122b
diff --git a/api/app/clients/ChatGPTClient.js b/api/app/clients/ChatGPTClient.js
index 802ba162d9..bac7849a15 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(/(?<!\/)\/(chat|completion)\//)[0];
if (this.options.forcePrompt) {
baseURL += '/completions';
diff --git a/api/app/clients/OpenAIClient.js b/api/app/clients/OpenAIClient.js
index 0abb71f1cc..bb4b5c6bb2 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;
@@ -1064,7 +1065,8 @@ ${convo}
baseURL: this.langchainProxy,
azureOptions: this.azure,
})
- : this.azureEndpoint.split(/\/(chat|completion)/)[0];
+ : this.azureEndpoint.split(/(?<!\/)\/(chat|completion)\//)[0];
+
opts.defaultQuery = { 'api-version': this.azure.azureOpenAIApiVersion };
opts.defaultHeaders = { ...opts.defaultHeaders, 'api-key': this.apiKey };
}
diff --git a/api/server/services/Endpoints/assistants/buildOptions.js b/api/server/services/Endpoints/assistants/buildOptions.js
index 4197d976be..c670953539 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,
},