mirror of
https://github.com/danny-avila/LibreChat.git
synced 2026-01-29 05:36:13 +01:00
🔧 fix: Apply Mongoose Plugin at Model Creation (#7749)
* fix: apply mongoMeili when models are created to use main runtime mongoose * chore: update @librechat/data-schemas version to 0.0.8 * refactor: remove unused useDebounceCodeBlock * fix: ensure setter function is stable and handle numeric conversion in useDebouncedInput * refactor: replace useCallback with useMemo for stable debounced function in useDebouncedInput
This commit is contained in:
parent
be4cf5846c
commit
dff4fcac00
9 changed files with 40 additions and 73 deletions
|
|
@ -1,5 +1,4 @@
|
|||
import { Schema } from 'mongoose';
|
||||
import mongoMeili from '~/models/plugins/mongoMeili';
|
||||
import { conversationPreset } from './defaults';
|
||||
import { IConversation } from '~/types';
|
||||
|
||||
|
|
@ -48,14 +47,4 @@ convoSchema.index({ expiredAt: 1 }, { expireAfterSeconds: 0 });
|
|||
convoSchema.index({ createdAt: 1, updatedAt: 1 });
|
||||
convoSchema.index({ conversationId: 1, user: 1 }, { unique: true });
|
||||
|
||||
if (process.env.MEILI_HOST && process.env.MEILI_MASTER_KEY) {
|
||||
convoSchema.plugin(mongoMeili, {
|
||||
host: process.env.MEILI_HOST,
|
||||
apiKey: process.env.MEILI_MASTER_KEY,
|
||||
/** Note: Will get created automatically if it doesn't exist already */
|
||||
indexName: 'convos',
|
||||
primaryKey: 'conversationId',
|
||||
});
|
||||
}
|
||||
|
||||
export default convoSchema;
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
import mongoose, { Schema } from 'mongoose';
|
||||
import type { IMessage } from '~/types/message';
|
||||
import mongoMeili from '~/models/plugins/mongoMeili';
|
||||
|
||||
const messageSchema: Schema<IMessage> = new Schema(
|
||||
{
|
||||
|
|
@ -166,13 +165,4 @@ messageSchema.index({ expiredAt: 1 }, { expireAfterSeconds: 0 });
|
|||
messageSchema.index({ createdAt: 1 });
|
||||
messageSchema.index({ messageId: 1, user: 1 }, { unique: true });
|
||||
|
||||
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 default messageSchema;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue