2023-03-21 20:06:27 -04:00
|
|
|
const mongoose = require('mongoose');
|
2023-03-22 01:31:01 -04:00
|
|
|
const mongoMeili = require('../plugins/mongoMeili');
|
2025-03-07 17:55:44 +01:00
|
|
|
|
|
|
|
|
const { convoSchema } = require('@librechat/data-schemas');
|
2023-03-22 01:31:01 -04:00
|
|
|
|
2023-03-22 10:23:55 -04:00
|
|
|
if (process.env.MEILI_HOST && process.env.MEILI_MASTER_KEY) {
|
2023-03-22 09:38:38 -04:00
|
|
|
convoSchema.plugin(mongoMeili, {
|
|
|
|
|
host: process.env.MEILI_HOST,
|
2023-03-22 10:23:55 -04:00
|
|
|
apiKey: process.env.MEILI_MASTER_KEY,
|
2025-02-26 15:02:03 -05:00
|
|
|
/** Note: Will get created automatically if it doesn't exist already */
|
|
|
|
|
indexName: 'convos',
|
2023-07-14 09:36:49 -04:00
|
|
|
primaryKey: 'conversationId',
|
2023-03-22 09:38:38 -04:00
|
|
|
});
|
|
|
|
|
}
|
2023-03-22 01:31:01 -04:00
|
|
|
|
|
|
|
|
const Conversation = mongoose.models.Conversation || mongoose.model('Conversation', convoSchema);
|
|
|
|
|
|
|
|
|
|
module.exports = Conversation;
|