mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-12-17 00:40:14 +01:00
🪰 fix: Azure Parsing and Assistants Payload (#2133)
* fix(azure): fix regex to prevent edge cases * fix(assistants): pass relevant endpoint options to avoid sending them to API
This commit is contained in:
parent
7cddd943d0
commit
f51ac74e12
3 changed files with 8 additions and 5 deletions
|
|
@ -236,7 +236,7 @@ class ChatGPTClient extends BaseClient {
|
||||||
baseURL: this.langchainProxy,
|
baseURL: this.langchainProxy,
|
||||||
azureOptions: this.azure,
|
azureOptions: this.azure,
|
||||||
})
|
})
|
||||||
: this.azureEndpoint.split(/\/(chat|completion)/)[0];
|
: this.azureEndpoint.split(/(?<!\/)\/(chat|completion)\//)[0];
|
||||||
|
|
||||||
if (this.options.forcePrompt) {
|
if (this.options.forcePrompt) {
|
||||||
baseURL += '/completions';
|
baseURL += '/completions';
|
||||||
|
|
|
||||||
|
|
@ -744,9 +744,10 @@ class OpenAIClient extends BaseClient {
|
||||||
/** @type {TAzureConfig | undefined} */
|
/** @type {TAzureConfig | undefined} */
|
||||||
const azureConfig = this.options?.req?.app?.locals?.[EModelEndpoint.azureOpenAI];
|
const azureConfig = this.options?.req?.app?.locals?.[EModelEndpoint.azureOpenAI];
|
||||||
|
|
||||||
const resetTitleOptions =
|
const resetTitleOptions = !!(
|
||||||
(this.azure && azureConfig) ||
|
(this.azure && azureConfig) ||
|
||||||
(azureConfig && this.options.endpoint === EModelEndpoint.azureOpenAI);
|
(azureConfig && this.options.endpoint === EModelEndpoint.azureOpenAI)
|
||||||
|
);
|
||||||
|
|
||||||
if (resetTitleOptions) {
|
if (resetTitleOptions) {
|
||||||
const { modelGroupMap, groupMap } = azureConfig;
|
const { modelGroupMap, groupMap } = azureConfig;
|
||||||
|
|
@ -1064,7 +1065,8 @@ ${convo}
|
||||||
baseURL: this.langchainProxy,
|
baseURL: this.langchainProxy,
|
||||||
azureOptions: this.azure,
|
azureOptions: this.azure,
|
||||||
})
|
})
|
||||||
: this.azureEndpoint.split(/\/(chat|completion)/)[0];
|
: this.azureEndpoint.split(/(?<!\/)\/(chat|completion)\//)[0];
|
||||||
|
|
||||||
opts.defaultQuery = { 'api-version': this.azure.azureOpenAIApiVersion };
|
opts.defaultQuery = { 'api-version': this.azure.azureOpenAIApiVersion };
|
||||||
opts.defaultHeaders = { ...opts.defaultHeaders, 'api-key': this.apiKey };
|
opts.defaultHeaders = { ...opts.defaultHeaders, 'api-key': this.apiKey };
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,10 @@
|
||||||
const buildOptions = (endpoint, parsedBody) => {
|
const buildOptions = (endpoint, parsedBody) => {
|
||||||
// eslint-disable-next-line no-unused-vars
|
// eslint-disable-next-line no-unused-vars
|
||||||
const { promptPrefix, chatGptLabel, resendImages, imageDetail, ...rest } = parsedBody;
|
const { promptPrefix, assistant_id, ...rest } = parsedBody;
|
||||||
const endpointOption = {
|
const endpointOption = {
|
||||||
endpoint,
|
endpoint,
|
||||||
promptPrefix,
|
promptPrefix,
|
||||||
|
assistant_id,
|
||||||
modelOptions: {
|
modelOptions: {
|
||||||
...rest,
|
...rest,
|
||||||
},
|
},
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue