mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-12-17 00:40:14 +01:00
* 🔄 fix: Include usage in stream options for OpenAI and Azure endpoints * fix: Agents support for Azure serverless endpoints * fix: Refactor condition for assistants and azureAssistants endpoint handling * AWS Titan via Bedrock: model doesn't support system messages, Closes #6456 * fix: Add EndpointSchemaKey type to endpoint parameters in buildDefaultConvo and ensure assistantId is always defined * fix: Handle new conversation state for assistants endpoint in finalHandler * fix: Add spec and iconURL parameters to `saveAssistantMessage` to persist modelSpec fields * fix: Handle assistant unlinking even if no valid files to delete * chore: move type definitions from callbacks.js to typedefs.js * chore: Add StandardGraph typedef to typedefs.js * chore: Update parameter type for graph in ModelEndHandler to StandardGraph --------- Co-authored-by: Andres Restrepo <andres@enric.ai>
40 lines
1.2 KiB
JavaScript
40 lines
1.2 KiB
JavaScript
const { removeNullishValues } = require('librechat-data-provider');
|
|
const generateArtifactsPrompt = require('~/app/clients/prompts/artifacts');
|
|
const { getAssistant } = require('~/models/Assistant');
|
|
|
|
const buildOptions = async (endpoint, parsedBody) => {
|
|
const { promptPrefix, assistant_id, iconURL, greeting, spec, artifacts, ...modelOptions } =
|
|
parsedBody;
|
|
const endpointOption = removeNullishValues({
|
|
endpoint,
|
|
promptPrefix,
|
|
assistant_id,
|
|
iconURL,
|
|
greeting,
|
|
spec,
|
|
modelOptions,
|
|
});
|
|
|
|
if (assistant_id) {
|
|
const assistantDoc = await getAssistant({ assistant_id });
|
|
|
|
if (assistantDoc) {
|
|
// Create a clean assistant object with only the needed properties
|
|
endpointOption.assistant = {
|
|
append_current_datetime: assistantDoc.append_current_datetime,
|
|
assistant_id: assistantDoc.assistant_id,
|
|
conversation_starters: assistantDoc.conversation_starters,
|
|
createdAt: assistantDoc.createdAt,
|
|
updatedAt: assistantDoc.updatedAt,
|
|
};
|
|
}
|
|
}
|
|
|
|
if (typeof artifacts === 'string') {
|
|
endpointOption.artifactsPrompt = generateArtifactsPrompt({ endpoint, artifacts });
|
|
}
|
|
|
|
return endpointOption;
|
|
};
|
|
|
|
module.exports = buildOptions;
|