🐛 fix: Handle optional endpoints in processModelSpecs function

This commit is contained in:
Danny Avila 2025-01-09 18:18:14 -05:00
parent 0f95604a67
commit ea1a5c8a30
No known key found for this signature in database
GPG key ID: BF31EEB2C5CA0956

View file

@ -4,7 +4,7 @@ const { logger } = require('~/config');
/**
* Sets up Model Specs from the config (`librechat.yaml`) file.
* @param {TCustomConfig['endpoints']} endpoints - The loaded custom configuration for endpoints.
* @param {TCustomConfig['endpoints']} [endpoints] - The loaded custom configuration for endpoints.
* @param {TCustomConfig['modelSpecs'] | undefined} [modelSpecs] - The loaded custom configuration for model specs.
* @returns {TCustomConfig['modelSpecs'] | undefined} The processed model specs, if any.
*/
@ -18,7 +18,7 @@ function processModelSpecs(endpoints, _modelSpecs) {
/** @type {TCustomConfig['modelSpecs']['list']} */
const list = _modelSpecs.list;
const customEndpoints = endpoints[EModelEndpoint.custom] ?? [];
const customEndpoints = endpoints?.[EModelEndpoint.custom] ?? [];
for (const spec of list) {
if (EModelEndpoint[spec.preset.endpoint] && spec.preset.endpoint !== EModelEndpoint.custom) {