🗨️ refactor: Optimize Prompt Queries

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
This commit is contained in:
Danny Avila 2025-08-11 22:06:15 -04:00
parent 53c31b85d0
commit dcd96c29c5
No known key found for this signature in database
GPG key ID: BF31EEB2C5CA0956
22 changed files with 583 additions and 259 deletions

View file

@ -1,13 +1,5 @@
import { Schema, Document, Types } from 'mongoose';
export interface IPrompt extends Document {
groupId: Types.ObjectId;
author: Types.ObjectId;
prompt: string;
type: 'text' | 'chat';
createdAt?: Date;
updatedAt?: Date;
}
import { Schema } from 'mongoose';
import type { IPrompt } from '~/types';
const promptSchema: Schema<IPrompt> = new Schema(
{

View file

@ -1,21 +1,6 @@
import { Schema, Document, Types } from 'mongoose';
import { Schema } from 'mongoose';
import { Constants } from 'librechat-data-provider';
export interface IPromptGroup {
name: string;
numberOfGenerations: number;
oneliner: string;
category: string;
projectIds: Types.ObjectId[];
productionId: Types.ObjectId;
author: Types.ObjectId;
authorName: string;
command?: string;
createdAt?: Date;
updatedAt?: Date;
}
export interface IPromptGroupDocument extends IPromptGroup, Document {}
import type { IPromptGroupDocument } from '~/types';
const promptGroupSchema = new Schema<IPromptGroupDocument>(
{

View file

@ -18,6 +18,8 @@ export * from './share';
export * from './pluginAuth';
/* Memories */
export * from './memory';
/* Prompts */
export * from './prompts';
/* Access Control */
export * from './accessRole';
export * from './aclEntry';

View file

@ -0,0 +1,27 @@
import type { Document, Types } from 'mongoose';
export interface IPrompt extends Document {
groupId: Types.ObjectId;
author: Types.ObjectId;
prompt: string;
type: 'text' | 'chat';
createdAt?: Date;
updatedAt?: Date;
}
export interface IPromptGroup {
name: string;
numberOfGenerations: number;
oneliner: string;
category: string;
projectIds: Types.ObjectId[];
productionId: Types.ObjectId;
author: Types.ObjectId;
authorName: string;
command?: string;
createdAt?: Date;
updatedAt?: Date;
isPublic?: boolean;
}
export interface IPromptGroupDocument extends IPromptGroup, Document {}