mirror of
https://github.com/danny-avila/LibreChat.git
synced 2026-01-22 02:06:12 +01:00
34 lines
663 B
TypeScript
34 lines
663 B
TypeScript
|
|
import { Schema } from 'mongoose';
|
||
|
|
import type { IMemoryEntry } from '~/types/memory';
|
||
|
|
|
||
|
|
const MemoryEntrySchema: Schema<IMemoryEntry> = new Schema({
|
||
|
|
userId: {
|
||
|
|
type: Schema.Types.ObjectId,
|
||
|
|
ref: 'User',
|
||
|
|
index: true,
|
||
|
|
required: true,
|
||
|
|
},
|
||
|
|
key: {
|
||
|
|
type: String,
|
||
|
|
required: true,
|
||
|
|
validate: {
|
||
|
|
validator: (v: string) => /^[a-z_]+$/.test(v),
|
||
|
|
message: 'Key must only contain lowercase letters and underscores',
|
||
|
|
},
|
||
|
|
},
|
||
|
|
value: {
|
||
|
|
type: String,
|
||
|
|
required: true,
|
||
|
|
},
|
||
|
|
tokenCount: {
|
||
|
|
type: Number,
|
||
|
|
default: 0,
|
||
|
|
},
|
||
|
|
updated_at: {
|
||
|
|
type: Date,
|
||
|
|
default: Date.now,
|
||
|
|
},
|
||
|
|
});
|
||
|
|
|
||
|
|
export default MemoryEntrySchema;
|