mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-12-21 19:00:13 +01:00
search: correctly register/export schema/models for mongoMeili
This commit is contained in:
parent
8be19f9982
commit
a5cf2f9148
6 changed files with 231 additions and 53 deletions
|
|
@ -1,5 +1,6 @@
|
|||
const mongoose = require('mongoose');
|
||||
module.exports = mongoose.Schema(
|
||||
const mongoMeili = require('../plugins/mongoMeili');
|
||||
const convoSchema = mongoose.Schema(
|
||||
{
|
||||
conversationId: {
|
||||
type: String,
|
||||
|
|
@ -50,4 +51,15 @@ module.exports = mongoose.Schema(
|
|||
messages: [{ type: mongoose.Schema.Types.ObjectId, ref: 'Message' }]
|
||||
},
|
||||
{ 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);
|
||||
|
||||
module.exports = Conversation;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue