e115934061
Publish `@librechat/data-schemas` to NPM / pack (push) Failing after 8s
Publish `@librechat/client` to NPM / pack (push) Failing after 0s
GitNexus Index / index (push) Failing after 1s
Sync Locize Translations & Create Translation PR / Create Translation PR on Version Published (push) Has been skipped
Sync Helm Chart Tags / Sync chart tags (push) Failing after 2s
Publish `librechat-data-provider` to NPM / pack (push) Failing after 1s
Docker Dev Images Build / build (Dockerfile, librechat-dev, node) (push) Failing after 1s
Docker Dev Images Build / build (Dockerfile.multi, librechat-dev-api, api-build) (push) Failing after 0s
Sync Helm Chart Tags / Ignore non-main push (push) Has been skipped
Sync Locize Translations & Create Translation PR / Sync Translation Keys with Locize (push) Failing after 1s
Publish `@librechat/client` to NPM / publish-npm (push) Has been cancelled
Publish `librechat-data-provider` to NPM / publish-npm (push) Has been cancelled
GitNexus Index / post-index (push) Has been cancelled
Publish `@librechat/data-schemas` to NPM / publish-npm (push) Has been cancelled
40 lines
1.5 KiB
JavaScript
40 lines
1.5 KiB
JavaScript
const { EModelEndpoint, getEnabledEndpoints } = require('librechat-data-provider');
|
|
const loadAsyncEndpoints = require('./loadAsyncEndpoints');
|
|
const { config } = require('./EndpointService');
|
|
|
|
/**
|
|
* Load async endpoints and return a configuration object
|
|
* @param {AppConfig} appConfig - The app configuration object
|
|
* @returns {Promise<Object.<string, EndpointWithOrder>>} An object whose keys are endpoint names and values are objects that contain the endpoint configuration and an order.
|
|
*/
|
|
async function loadDefaultEndpointsConfig(appConfig) {
|
|
const { assistants, azureAssistants, azureOpenAI } = config;
|
|
|
|
const enabledEndpoints = getEnabledEndpoints();
|
|
const { google } = enabledEndpoints.includes(EModelEndpoint.google)
|
|
? await loadAsyncEndpoints(appConfig)
|
|
: { google: false };
|
|
|
|
const endpointConfig = {
|
|
[EModelEndpoint.openAI]: config[EModelEndpoint.openAI],
|
|
[EModelEndpoint.agents]: config[EModelEndpoint.agents],
|
|
[EModelEndpoint.assistants]: assistants,
|
|
[EModelEndpoint.azureAssistants]: azureAssistants,
|
|
[EModelEndpoint.azureOpenAI]: azureOpenAI,
|
|
[EModelEndpoint.google]: google,
|
|
[EModelEndpoint.anthropic]: config[EModelEndpoint.anthropic],
|
|
[EModelEndpoint.bedrock]: config[EModelEndpoint.bedrock],
|
|
};
|
|
|
|
const orderedAndFilteredEndpoints = enabledEndpoints.reduce((config, key, index) => {
|
|
if (endpointConfig[key]) {
|
|
config[key] = { ...(endpointConfig[key] ?? {}), order: index };
|
|
}
|
|
return config;
|
|
}, {});
|
|
|
|
return orderedAndFilteredEndpoints;
|
|
}
|
|
|
|
module.exports = loadDefaultEndpointsConfig;
|