mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-12-17 08:50:15 +01:00
fix: clearConvo will remove all messages
This commit is contained in:
parent
7d43032a98
commit
d8ccc5b870
1 changed files with 6 additions and 10 deletions
|
|
@ -45,13 +45,9 @@ module.exports = {
|
||||||
},
|
},
|
||||||
updateConvo: async (user, { conversationId, ...update }) => {
|
updateConvo: async (user, { conversationId, ...update }) => {
|
||||||
try {
|
try {
|
||||||
return await Conversation.findOneAndUpdate(
|
return await Conversation.findOneAndUpdate({ conversationId: conversationId, user }, update, {
|
||||||
{ conversationId: conversationId, user },
|
new: true
|
||||||
update,
|
}).exec();
|
||||||
{
|
|
||||||
new: true
|
|
||||||
}
|
|
||||||
).exec();
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(error);
|
console.log(error);
|
||||||
return { message: 'Error updating conversation' };
|
return { message: 'Error updating conversation' };
|
||||||
|
|
@ -89,7 +85,7 @@ module.exports = {
|
||||||
promises.push(
|
promises.push(
|
||||||
Conversation.findOne({
|
Conversation.findOne({
|
||||||
user,
|
user,
|
||||||
conversationId: convo.conversationId,
|
conversationId: convo.conversationId
|
||||||
}).exec()
|
}).exec()
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
@ -143,13 +139,13 @@ module.exports = {
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(error);
|
console.log(error);
|
||||||
return 'Error getting conversation title';
|
return { message: 'Error getting conversation title' };
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
deleteConvos: async (user, filter) => {
|
deleteConvos: async (user, filter) => {
|
||||||
let deleteCount = await Conversation.deleteMany({ ...filter, user }).exec();
|
let deleteCount = await Conversation.deleteMany({ ...filter, user }).exec();
|
||||||
console.log('deleteCount', deleteCount);
|
console.log('deleteCount', deleteCount);
|
||||||
deleteCount.messages = await deleteMessages(filter);
|
deleteCount.messages = await deleteMessages({ ...filter, user });
|
||||||
return deleteCount;
|
return deleteCount;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue