mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-12-17 08:50:15 +01:00
* refactor: remove `useChatContext` from `useSelectMention`, explicitly pass `conversation` object * feat: ephemeral agents via model specs * refactor: Sync Jotai state with ephemeral agent state, also when Ephemeral Agent has no MCP servers selected * refactor: move `useUpdateEphemeralAgent` to store and clean up imports * refactor: reorder imports and invalidate queries for mcpConnectionStatus in event handler * refactor: replace useApplyModelSpecEffects with useApplyModelSpecAgents and update event handlers to use new agent template logic * ci: update useMCPSelect test to verify mcpValues sync with empty ephemeralAgent.mcp
29 lines
860 B
JavaScript
29 lines
860 B
JavaScript
const { logger } = require('@librechat/data-schemas');
|
|
const { isAgentsEndpoint, removeNullishValues, Constants } = require('librechat-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,
|
|
agent_id: isAgentsEndpoint(endpoint) ? 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;
|
|
});
|
|
|
|
return removeNullishValues({
|
|
spec,
|
|
iconURL,
|
|
endpoint,
|
|
agent_id,
|
|
endpointType,
|
|
model_parameters,
|
|
agent: agentPromise,
|
|
});
|
|
};
|
|
|
|
module.exports = { buildOptions };
|