mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-12-20 10:20:15 +01:00
28 lines
686 B
JavaScript
28 lines
686 B
JavaScript
const { getAgent } = require('~/models/Agent');
|
|
const { logger } = require('~/config');
|
|
|
|
const buildOptions = (req, endpoint, parsedBody) => {
|
|
const { agent_id, instructions, spec, ...model_parameters } = parsedBody;
|
|
|
|
const agentPromise = getAgent({
|
|
id: agent_id,
|
|
// TODO: better author handling
|
|
author: req.user.id,
|
|
}).catch((error) => {
|
|
logger.error(`[/agents/:${agent_id}] Error retrieving agent during build options step`, error);
|
|
return undefined;
|
|
});
|
|
|
|
const endpointOption = {
|
|
agent: agentPromise,
|
|
endpoint,
|
|
agent_id,
|
|
instructions,
|
|
spec,
|
|
model_parameters,
|
|
};
|
|
|
|
return endpointOption;
|
|
};
|
|
|
|
module.exports = { buildOptions };
|