mirror of
https://github.com/danny-avila/LibreChat.git
synced 2026-03-14 19:56:34 +01:00
backend logic drafted, moving to frontend
This commit is contained in:
parent
4f5ee8b198
commit
610cba4a60
8 changed files with 237 additions and 72 deletions
|
|
@ -1,4 +1,5 @@
|
|||
const mongoose = require('mongoose');
|
||||
const mongoMeili = require('../lib/db/mongoMeili');
|
||||
const { getMessages, deleteMessages } = require('./Message');
|
||||
|
||||
const convoSchema = mongoose.Schema(
|
||||
|
|
@ -6,7 +7,9 @@ const convoSchema = mongoose.Schema(
|
|||
conversationId: {
|
||||
type: String,
|
||||
unique: true,
|
||||
required: true
|
||||
required: true,
|
||||
index: true,
|
||||
meiliIndex: true
|
||||
},
|
||||
parentMessageId: {
|
||||
type: String,
|
||||
|
|
@ -14,7 +17,8 @@ const convoSchema = mongoose.Schema(
|
|||
},
|
||||
title: {
|
||||
type: String,
|
||||
default: 'New Chat'
|
||||
default: 'New Chat',
|
||||
meiliIndex: true
|
||||
},
|
||||
jailbreakConversationId: {
|
||||
type: String,
|
||||
|
|
@ -51,6 +55,13 @@ const convoSchema = mongoose.Schema(
|
|||
{ timestamps: true }
|
||||
);
|
||||
|
||||
convoSchema.plugin(mongoMeili, {
|
||||
host: process.env.MEILI_HOST,
|
||||
apiKey: process.env.MEILI_KEY,
|
||||
indexName: 'convos', // Will get created automatically if it doesn't exist already
|
||||
primaryKey: 'conversationId',
|
||||
});
|
||||
|
||||
const Conversation =
|
||||
mongoose.models.Conversation || mongoose.model('Conversation', convoSchema);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue