| | const { EModelEndpoint, getEnabledEndpoints } = require('librechat-data-provider'); |
| | const loadAsyncEndpoints = require('./loadAsyncEndpoints'); |
| | const { config } = require('./EndpointService'); |
| |
|
| | |
| | |
| | |
| | |
| | |
| | async function loadDefaultEndpointsConfig(appConfig) { |
| | const { google, gptPlugins } = await loadAsyncEndpoints(appConfig); |
| | const { assistants, azureAssistants, azureOpenAI, chatGPTBrowser } = config; |
| |
|
| | const enabledEndpoints = getEnabledEndpoints(); |
| |
|
| | 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.chatGPTBrowser]: chatGPTBrowser, |
| | [EModelEndpoint.gptPlugins]: gptPlugins, |
| | [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; |
| |
|