mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-12-21 02:40:14 +01:00
* 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
50 lines
1.1 KiB
TypeScript
50 lines
1.1 KiB
TypeScript
import { Schema } from 'mongoose';
|
|
import { conversationPreset } from './defaults';
|
|
import { IConversation } from '~/types';
|
|
|
|
const convoSchema: Schema<IConversation> = new Schema(
|
|
{
|
|
conversationId: {
|
|
type: String,
|
|
unique: true,
|
|
required: true,
|
|
index: true,
|
|
meiliIndex: true,
|
|
},
|
|
title: {
|
|
type: String,
|
|
default: 'New Chat',
|
|
meiliIndex: true,
|
|
},
|
|
user: {
|
|
type: String,
|
|
index: true,
|
|
},
|
|
messages: [{ type: Schema.Types.ObjectId, ref: 'Message' }],
|
|
agentOptions: {
|
|
type: Schema.Types.Mixed,
|
|
},
|
|
...conversationPreset,
|
|
agent_id: {
|
|
type: String,
|
|
},
|
|
tags: {
|
|
type: [String],
|
|
default: [],
|
|
meiliIndex: true,
|
|
},
|
|
files: {
|
|
type: [String],
|
|
},
|
|
expiredAt: {
|
|
type: Date,
|
|
},
|
|
},
|
|
{ timestamps: true },
|
|
);
|
|
|
|
convoSchema.index({ expiredAt: 1 }, { expireAfterSeconds: 0 });
|
|
convoSchema.index({ createdAt: 1, updatedAt: 1 });
|
|
convoSchema.index({ conversationId: 1, user: 1 }, { unique: true });
|
|
|
|
export default convoSchema;
|