mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-09-22 06:00:56 +02:00
🌿 fix: Message Route Improvements pt. 2 (#3379)
* fix: edge case with debugTraverse function in parsers.js * chore: Update error message in audio stream processing * refactor: Add ONE_MINUTE and THIRTY_SECONDS options to Time enum * fix: logging
This commit is contained in:
parent
1acd47a0f6
commit
f6125ccd59
10 changed files with 61 additions and 15 deletions
|
@ -29,10 +29,12 @@ const idSchema = z.string().uuid();
|
|||
* @param {string} [params.plugin] - Plugin associated with the message.
|
||||
* @param {string[]} [params.plugins] - An array of plugins associated with the message.
|
||||
* @param {string} [params.model] - The model used to generate the message.
|
||||
* @param {Object} [metadata] - Additional metadata for this operation
|
||||
* @param {string} [metadata.context] - The context of the operation
|
||||
* @returns {Promise<TMessage>} The updated or newly inserted message document.
|
||||
* @throws {Error} If there is an error in saving the message.
|
||||
*/
|
||||
async function saveMessage(req, params) {
|
||||
async function saveMessage(req, params, metadata) {
|
||||
try {
|
||||
if (!req || !req.user || !req.user.id) {
|
||||
throw new Error('User not authenticated');
|
||||
|
@ -61,8 +63,16 @@ async function saveMessage(req, params) {
|
|||
|
||||
const validConvoId = idSchema.safeParse(conversationId);
|
||||
if (!validConvoId.success) {
|
||||
if (metadata && metadata?.context) {
|
||||
logger.info(`\`saveMessage\` context: ${metadata.context}`);
|
||||
}
|
||||
|
||||
logger.warn(`Invalid conversation ID: ${conversationId}`);
|
||||
logger.info(params);
|
||||
logger.info(`Invalid conversation ID Params:
|
||||
|
||||
${JSON.stringify(params, null, 2)}
|
||||
|
||||
`);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue