mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-12-17 17:00:15 +01:00
working sydney, need to test the other models
This commit is contained in:
parent
2c1ae68dc4
commit
67054e7504
6 changed files with 75 additions and 26 deletions
|
|
@ -47,6 +47,15 @@ const convoSchema = mongoose.Schema({
|
|||
const Conversation =
|
||||
mongoose.models.Conversation || mongoose.model('Conversation', convoSchema);
|
||||
|
||||
const getConvo = async (conversationId) => {
|
||||
try {
|
||||
return await Conversation.findOne({ conversationId }).exec();
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
return { message: 'Error getting single conversation' };
|
||||
}
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
saveConvo: async ({ conversationId, title, ...convo }) => {
|
||||
try {
|
||||
|
|
@ -95,12 +104,14 @@ module.exports = {
|
|||
return { message: 'Error getting conversations' };
|
||||
}
|
||||
},
|
||||
getConvo: async (conversationId) => {
|
||||
getConvo,
|
||||
getConvoTitle: async (conversationId) => {
|
||||
try {
|
||||
return await Conversation.findOne({ conversationId }).exec();
|
||||
const convo = await getConvo(conversationId);
|
||||
return convo.title;
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
return { message: 'Error getting single conversation' };
|
||||
return { message: 'Error getting conversation title' };
|
||||
}
|
||||
},
|
||||
deleteConvos: async (filter) => {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue