Files
zeekay 32969de598 fork: rename internal workspace packages to @hanzochat scope
librechat-data-provider  → @hanzochat/data-provider
@librechat/data-schemas  → @hanzochat/data-schemas
@librechat/client        → @hanzochat/client
(@hanzochat/api already forked; external @librechat/agents fork follows)

All imports, package.json names/deps, tsconfig path aliases, jest
moduleNameMapper, and rollup/vite build aliases updated. The data-provider
react-query subpath resolves via the exports map. Lockfiles regenerated in a
follow-on once the canonical package manager is confirmed.
2026-07-14 05:55:49 -07:00

37 lines
1.2 KiB
JavaScript

const { logger } = require('@hanzochat/data-schemas');
const { isAgentsEndpoint, removeNullishValues, Constants } = require('@hanzochat/data-provider');
const { loadAgent } = require('~/models/Agent');
const buildOptions = (req, endpoint, parsedBody, endpointType) => {
const { spec, iconURL, agent_id, ...model_parameters } = parsedBody;
const agentPromise = loadAgent({
req,
spec,
// No agent selected on the agents endpoint → ad-hoc (ephemeral) chat, so the
// user gets a reply without first creating/selecting an agent. Mirrors the
// access middleware, which treats a missing id as ephemeral.
agent_id: isAgentsEndpoint(endpoint) && agent_id ? agent_id : Constants.EPHEMERAL_AGENT_ID,
endpoint,
model_parameters,
}).catch((error) => {
logger.error(`[/agents/:${agent_id}] Error retrieving agent during build options step`, error);
return undefined;
});
/** @type {import('@hanzochat/data-provider').TConversation | undefined} */
const addedConvo = req.body?.addedConvo;
return removeNullishValues({
spec,
iconURL,
endpoint,
agent_id,
endpointType,
model_parameters,
agent: agentPromise,
addedConvo,
});
};
module.exports = { buildOptions };