From 1b14721e752dccd86d411890e19ac1702025c48f Mon Sep 17 00:00:00 2001 From: Danny Avila Date: Mon, 11 Aug 2025 22:06:15 -0400 Subject: [PATCH] feat: Refactor prompt and prompt group schemas; move types to separate file --- packages/data-schemas/src/schema/prompt.ts | 12 ++------- .../data-schemas/src/schema/promptGroup.ts | 19 ++----------- packages/data-schemas/src/types/index.ts | 2 ++ packages/data-schemas/src/types/prompts.ts | 27 +++++++++++++++++++ 4 files changed, 33 insertions(+), 27 deletions(-) create mode 100644 packages/data-schemas/src/types/prompts.ts diff --git a/packages/data-schemas/src/schema/prompt.ts b/packages/data-schemas/src/schema/prompt.ts index eef966c9c7..017eeea5e3 100644 --- a/packages/data-schemas/src/schema/prompt.ts +++ b/packages/data-schemas/src/schema/prompt.ts @@ -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 = new Schema( { diff --git a/packages/data-schemas/src/schema/promptGroup.ts b/packages/data-schemas/src/schema/promptGroup.ts index ed5f88fe0e..2e8bb4ef82 100644 --- a/packages/data-schemas/src/schema/promptGroup.ts +++ b/packages/data-schemas/src/schema/promptGroup.ts @@ -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( { diff --git a/packages/data-schemas/src/types/index.ts b/packages/data-schemas/src/types/index.ts index 679553aa82..4a755beda7 100644 --- a/packages/data-schemas/src/types/index.ts +++ b/packages/data-schemas/src/types/index.ts @@ -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'; diff --git a/packages/data-schemas/src/types/prompts.ts b/packages/data-schemas/src/types/prompts.ts new file mode 100644 index 0000000000..d99d36eb73 --- /dev/null +++ b/packages/data-schemas/src/types/prompts.ts @@ -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 {}