mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-12-17 00:40:14 +01:00
* 🏗️ refactor: Extract reasoning key logic into separate function
* refactor: Ensure `overrideProvider` is always defined in `getProviderConfig` result, and only used in `initializeAgent` if different from `agent.provider`
* feat: new title configuration options across services
- titlePrompt
- titleEndpoint
- titlePromptTemplate
- new "completion" titleMethod (new default)
* chore: update @librechat/agents and conform openai version to prevent SDK errors
* chore: add form-data package as a dependency and override to v4.0.4 to address CVE-2025-7783
* feat: add support for 'all' endpoint configuration in AppService and corresponding tests
* refactor: replace HttpsProxyAgent with ProxyAgent from undici for improved proxy handling in assistant initialization
* chore: update frontend review workflow to limit package paths to data-provider
* chore: update backend review workflow to include all package paths
63 lines
2.6 KiB
JavaScript
63 lines
2.6 KiB
JavaScript
const {
|
|
Capabilities,
|
|
assistantEndpointSchema,
|
|
defaultAssistantsVersion,
|
|
} = require('librechat-data-provider');
|
|
const { logger } = require('~/config');
|
|
|
|
/**
|
|
* Sets up the minimum, default Assistants configuration if Azure OpenAI Assistants option is enabled.
|
|
* @returns {Partial<TAssistantEndpoint>} The Assistants endpoint configuration.
|
|
*/
|
|
function azureAssistantsDefaults() {
|
|
return {
|
|
capabilities: [Capabilities.tools, Capabilities.actions, Capabilities.code_interpreter],
|
|
version: defaultAssistantsVersion.azureAssistants,
|
|
};
|
|
}
|
|
|
|
/**
|
|
* Sets up the Assistants configuration from the config (`librechat.yaml`) file.
|
|
* @param {TCustomConfig} config - The loaded custom configuration.
|
|
* @param {EModelEndpoint.assistants|EModelEndpoint.azureAssistants} assistantsEndpoint - The Assistants endpoint name.
|
|
* - The previously loaded assistants configuration from Azure OpenAI Assistants option.
|
|
* @param {Partial<TAssistantEndpoint>} [prevConfig]
|
|
* @returns {Partial<TAssistantEndpoint>} The Assistants endpoint configuration.
|
|
*/
|
|
function assistantsConfigSetup(config, assistantsEndpoint, prevConfig = {}) {
|
|
const assistantsConfig = config.endpoints[assistantsEndpoint];
|
|
const parsedConfig = assistantEndpointSchema.parse(assistantsConfig);
|
|
if (assistantsConfig.supportedIds?.length && assistantsConfig.excludedIds?.length) {
|
|
logger.warn(
|
|
`Configuration conflict: The '${assistantsEndpoint}' endpoint has both 'supportedIds' and 'excludedIds' defined. The 'excludedIds' will be ignored.`,
|
|
);
|
|
}
|
|
if (
|
|
assistantsConfig.privateAssistants &&
|
|
(assistantsConfig.supportedIds?.length || assistantsConfig.excludedIds?.length)
|
|
) {
|
|
logger.warn(
|
|
`Configuration conflict: The '${assistantsEndpoint}' endpoint has both 'privateAssistants' and 'supportedIds' or 'excludedIds' defined. The 'supportedIds' and 'excludedIds' will be ignored.`,
|
|
);
|
|
}
|
|
|
|
return {
|
|
...prevConfig,
|
|
retrievalModels: parsedConfig.retrievalModels,
|
|
disableBuilder: parsedConfig.disableBuilder,
|
|
pollIntervalMs: parsedConfig.pollIntervalMs,
|
|
supportedIds: parsedConfig.supportedIds,
|
|
capabilities: parsedConfig.capabilities,
|
|
excludedIds: parsedConfig.excludedIds,
|
|
privateAssistants: parsedConfig.privateAssistants,
|
|
timeoutMs: parsedConfig.timeoutMs,
|
|
streamRate: parsedConfig.streamRate,
|
|
titlePrompt: parsedConfig.titlePrompt,
|
|
titleMethod: parsedConfig.titleMethod,
|
|
titleModel: parsedConfig.titleModel,
|
|
titleEndpoint: parsedConfig.titleEndpoint,
|
|
titlePromptTemplate: parsedConfig.titlePromptTemplate,
|
|
};
|
|
}
|
|
|
|
module.exports = { azureAssistantsDefaults, assistantsConfigSetup };
|