mirror of
https://github.com/danny-avila/LibreChat.git
synced 2026-03-08 00:52:37 +01:00
refactor(data-schemas): introduce new models and types for balance, conversation, message, and session
- Added new model files for Balance, Conversation, Message, and Session, enhancing modularity. - Created corresponding type definitions for IBalance, IConversation, IMessage, and updated existing types. - Refactored index files to export models from their individual files for better organization.
This commit is contained in:
parent
f6ca8caf7e
commit
fa9177180f
14 changed files with 174 additions and 99 deletions
16
packages/data-schemas/src/models/message.ts
Normal file
16
packages/data-schemas/src/models/message.ts
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
import mongoose from 'mongoose';
|
||||
import mongoMeili from '~/models/plugins/mongoMeili';
|
||||
import messageSchema from '~/schema/message';
|
||||
import type * as t from '~/types';
|
||||
|
||||
if (process.env.MEILI_HOST && process.env.MEILI_MASTER_KEY) {
|
||||
messageSchema.plugin(mongoMeili, {
|
||||
host: process.env.MEILI_HOST,
|
||||
apiKey: process.env.MEILI_MASTER_KEY,
|
||||
indexName: 'messages',
|
||||
primaryKey: 'messageId',
|
||||
});
|
||||
}
|
||||
|
||||
export const Message =
|
||||
mongoose.models.Message || mongoose.model<t.IMessage>('Message', messageSchema);
|
||||
Loading…
Add table
Add a link
Reference in a new issue