mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-12-17 08:50:15 +01:00
21 lines
670 B
JavaScript
21 lines
670 B
JavaScript
|
|
const openAI = require('../routes/endpoints/openAI');
|
||
|
|
const gptPlugins = require('../routes/endpoints/gptPlugins');
|
||
|
|
const anthropic = require('../routes/endpoints/anthropic');
|
||
|
|
const { parseConvo } = require('../routes/endpoints/schemas');
|
||
|
|
|
||
|
|
const buildFunction = {
|
||
|
|
openAI: openAI.buildOptions,
|
||
|
|
azureOpenAI: openAI.buildOptions,
|
||
|
|
gptPlugins: gptPlugins.buildOptions,
|
||
|
|
anthropic: anthropic.buildOptions,
|
||
|
|
};
|
||
|
|
|
||
|
|
function buildEndpointOption(req, res, next) {
|
||
|
|
const { endpoint } = req.body;
|
||
|
|
const parsedBody = parseConvo(endpoint, req.body);
|
||
|
|
req.body.endpointOption = buildFunction[endpoint](endpoint, parsedBody);
|
||
|
|
next();
|
||
|
|
}
|
||
|
|
|
||
|
|
module.exports = buildEndpointOption;
|