mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-12-17 00:40:14 +01:00
🎚️ chore: Update Logging Levels for Conversations and Messages (#3415)
This commit is contained in:
parent
0bd59c0efe
commit
e5dfa06e6c
2 changed files with 9 additions and 6 deletions
|
|
@ -29,7 +29,7 @@ module.exports = {
|
||||||
saveConvo: async (req, { conversationId, newConversationId, ...convo }, metadata) => {
|
saveConvo: async (req, { conversationId, newConversationId, ...convo }, metadata) => {
|
||||||
try {
|
try {
|
||||||
if (metadata && metadata?.context) {
|
if (metadata && metadata?.context) {
|
||||||
logger.info(`[saveConvo] ${metadata.context}`);
|
logger.debug(`[saveConvo] ${metadata.context}`);
|
||||||
}
|
}
|
||||||
const messages = await getMessages({ conversationId }, '_id');
|
const messages = await getMessages({ conversationId }, '_id');
|
||||||
const update = { ...convo, messages, user: req.user.id };
|
const update = { ...convo, messages, user: req.user.id };
|
||||||
|
|
@ -49,6 +49,9 @@ module.exports = {
|
||||||
return conversation.toObject();
|
return conversation.toObject();
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
logger.error('[saveConvo] Error saving conversation', error);
|
logger.error('[saveConvo] Error saving conversation', error);
|
||||||
|
if (metadata && metadata?.context) {
|
||||||
|
logger.info(`[saveConvo] ${metadata.context}`);
|
||||||
|
}
|
||||||
return { message: 'Error saving conversation' };
|
return { message: 'Error saving conversation' };
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -63,12 +63,12 @@ async function saveMessage(req, params, metadata) {
|
||||||
|
|
||||||
const validConvoId = idSchema.safeParse(conversationId);
|
const validConvoId = idSchema.safeParse(conversationId);
|
||||||
if (!validConvoId.success) {
|
if (!validConvoId.success) {
|
||||||
|
logger.warn(`Invalid conversation ID: ${conversationId}`);
|
||||||
if (metadata && metadata?.context) {
|
if (metadata && metadata?.context) {
|
||||||
logger.info(`\`saveMessage\` context: ${metadata.context}`);
|
logger.info(`---\`saveMessage\` context: ${metadata.context}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
logger.warn(`Invalid conversation ID: ${conversationId}`);
|
logger.info(`---Invalid conversation ID Params:
|
||||||
logger.info(`Invalid conversation ID Params:
|
|
||||||
|
|
||||||
${JSON.stringify(params, null, 2)}
|
${JSON.stringify(params, null, 2)}
|
||||||
|
|
||||||
|
|
@ -109,7 +109,7 @@ ${JSON.stringify(params, null, 2)}
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
logger.error('Error saving message:', err);
|
logger.error('Error saving message:', err);
|
||||||
if (metadata && metadata?.context) {
|
if (metadata && metadata?.context) {
|
||||||
logger.info(`\`saveMessage\` context: ${metadata.context}`);
|
logger.info(`---\`saveMessage\` context: ${metadata.context}`);
|
||||||
}
|
}
|
||||||
throw err;
|
throw err;
|
||||||
}
|
}
|
||||||
|
|
@ -254,7 +254,7 @@ async function updateMessage(req, message, metadata) {
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
logger.error('Error updating message:', err);
|
logger.error('Error updating message:', err);
|
||||||
if (metadata && metadata?.context) {
|
if (metadata && metadata?.context) {
|
||||||
logger.info(`\`updateMessage\` context: ${metadata.context}`);
|
logger.info(`---\`updateMessage\` context: ${metadata.context}`);
|
||||||
}
|
}
|
||||||
throw err;
|
throw err;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue