mirror of
https://github.com/danny-avila/LibreChat.git
synced 2026-02-16 07:28:09 +01:00
feat: Refactor prompt and prompt group schemas; move types to separate file feat: Implement paginated access to prompt groups with filtering and public visibility refactor: Add PromptGroups context provider and integrate it into relevant components refactor: Optimize filter change handling and query invalidation in usePromptGroupsNav hook refactor: Simplify context usage in FilterPrompts and GroupSidePanel components
34 lines
627 B
TypeScript
34 lines
627 B
TypeScript
import { Schema } from 'mongoose';
|
|
import type { IPrompt } from '~/types';
|
|
|
|
const promptSchema: Schema<IPrompt> = new Schema(
|
|
{
|
|
groupId: {
|
|
type: Schema.Types.ObjectId,
|
|
ref: 'PromptGroup',
|
|
required: true,
|
|
index: true,
|
|
},
|
|
author: {
|
|
type: Schema.Types.ObjectId,
|
|
ref: 'User',
|
|
required: true,
|
|
},
|
|
prompt: {
|
|
type: String,
|
|
required: true,
|
|
},
|
|
type: {
|
|
type: String,
|
|
enum: ['text', 'chat'],
|
|
required: true,
|
|
},
|
|
},
|
|
{
|
|
timestamps: true,
|
|
},
|
|
);
|
|
|
|
promptSchema.index({ createdAt: 1, updatedAt: 1 });
|
|
|
|
export default promptSchema;
|