Download api/server/services/Config/loadDefaultEConfig.js from Zhitomir/chat: direct link, hf CLI and curl.
- Browser
- Download file 1.51 kB
-
https://huggingface.co/spaces/Zhitomir/chat/resolve/main/api/server/services/Config/loadDefaultEConfig.js
- Command line
-
hf download hf://spaces/Zhitomir/chat/api/server/services/Config/loadDefaultEConfig.js
-
curl -L -o loadDefaultEConfig.js https://huggingface.co/spaces/Zhitomir/chat/resolve/main/api/server/services/Config/loadDefaultEConfig.js
1.51 kB
| const { EModelEndpoint, getEnabledEndpoints } = require('librechat-data-provider'); | |
| const loadAsyncEndpoints = require('./loadAsyncEndpoints'); | |
| const { config } = require('./EndpointService'); | |
| /** | |
| * Load async endpoints and return a configuration object | |
| * @param {Express.Request} req - The request 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(req) { | |
| const { google, gptPlugins } = await loadAsyncEndpoints(req); | |
| const { openAI, assistants, azureAssistants, bingAI, anthropic, azureOpenAI, chatGPTBrowser } = | |
| config; | |
| const enabledEndpoints = getEnabledEndpoints(); | |
| const endpointConfig = { | |
| [EModelEndpoint.openAI]: openAI, | |
| [EModelEndpoint.assistants]: assistants, | |
| [EModelEndpoint.azureAssistants]: azureAssistants, | |
| [EModelEndpoint.azureOpenAI]: azureOpenAI, | |
| [EModelEndpoint.google]: google, | |
| [EModelEndpoint.bingAI]: bingAI, | |
| [EModelEndpoint.chatGPTBrowser]: chatGPTBrowser, | |
| [EModelEndpoint.gptPlugins]: gptPlugins, | |
| [EModelEndpoint.anthropic]: anthropic, | |
| }; | |
| const orderedAndFilteredEndpoints = enabledEndpoints.reduce((config, key, index) => { | |
| if (endpointConfig[key]) { | |
| config[key] = { ...(endpointConfig[key] ?? {}), order: index }; | |
| } | |
| return config; | |
| }, {}); | |
| return orderedAndFilteredEndpoints; | |
| } | |
| module.exports = loadDefaultEndpointsConfig; | |