mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-12-17 08:50:15 +01:00
🗨️ 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:
parent
53c31b85d0
commit
dcd96c29c5
22 changed files with 583 additions and 259 deletions
|
|
@ -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(
|
||||
{
|
||||
|
|
|
|||
|
|
@ -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>(
|
||||
{
|
||||
|
|
|
|||
|
|
@ -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';
|
||||
|
|
|
|||
27
packages/data-schemas/src/types/prompts.ts
Normal file
27
packages/data-schemas/src/types/prompts.ts
Normal 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 {}
|
||||
Loading…
Add table
Add a link
Reference in a new issue