mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-12-18 01:10:14 +01:00
optimistic ui for message sending and submit state
This commit is contained in:
parent
9d41ed4615
commit
6842ac880c
19 changed files with 430 additions and 92 deletions
|
|
@ -1,5 +1,5 @@
|
|||
const mongoose = require('mongoose');
|
||||
const { getMessages } = require('./Message');
|
||||
const { getMessages, deleteMessages } = require('./Message');
|
||||
|
||||
const convoSchema = mongoose.Schema({
|
||||
conversationId: {
|
||||
|
|
@ -26,7 +26,7 @@ const Conversation =
|
|||
mongoose.models.Conversation || mongoose.model('Conversation', convoSchema);
|
||||
|
||||
module.exports = {
|
||||
saveConversation: async ({ conversationId, parentMessageId, title }) => {
|
||||
saveConvo: async ({ conversationId, parentMessageId, title }) => {
|
||||
const messages = await getMessages({ conversationId });
|
||||
const update = { parentMessageId, messages };
|
||||
if (title) {
|
||||
|
|
@ -39,5 +39,16 @@ module.exports = {
|
|||
{ new: true, upsert: true }
|
||||
).exec();
|
||||
},
|
||||
getConversations: async () => await Conversation.find({}).exec(),
|
||||
getConvos: async () => await Conversation.find({}).exec(),
|
||||
deleteConvos: async (filter) => {
|
||||
// const filter = {};
|
||||
|
||||
// if (!!conversationId) {
|
||||
// filter = conversationId;
|
||||
// }
|
||||
|
||||
let deleteCount = await Conversation.deleteMany(filter).exec();
|
||||
deleteCount.messages = await deleteMessages(filter);
|
||||
return deleteCount;
|
||||
}
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue