mirror of
https://github.com/danny-avila/LibreChat.git
synced 2026-02-24 19:34:08 +01:00
🗨️ feat: Prompt Slash Commands (#3219)
* chore: Update prompt description placeholder text * fix: promptsPathPattern to not include new * feat: command input and styling change for prompt views * fix: intended validation * feat: prompts slash command * chore: localizations and fix add command during creation * refactor(PromptsCommand): better label * feat: update `allPrompGroups` cache on all promptGroups mutations * refactor: ensure assistants builder is first within sidepanel * refactor: allow defining emailVerified via create-user script
This commit is contained in:
parent
b8f2bee3fc
commit
83619de158
33 changed files with 764 additions and 80 deletions
|
|
@ -177,6 +177,8 @@ export const deletePrompt = ({ _id, groupId }: { _id: string; groupId: string })
|
|||
|
||||
export const getCategories = () => '/api/categories';
|
||||
|
||||
export const getAllPromptGroups = () => `${prompts()}/all`;
|
||||
|
||||
/* Roles */
|
||||
export const roles = () => '/api/roles';
|
||||
export const getRole = (roleName: string) => `${roles()}/${roleName.toLowerCase()}`;
|
||||
|
|
|
|||
|
|
@ -822,6 +822,8 @@ export enum Constants {
|
|||
CURRENT_MODEL = 'current_model',
|
||||
/** Common divider for text values */
|
||||
COMMON_DIVIDER = '__',
|
||||
/** Max length for commands */
|
||||
COMMANDS_MAX_LENGTH = 56,
|
||||
}
|
||||
|
||||
export enum LocalStorageKeys {
|
||||
|
|
|
|||
|
|
@ -475,6 +475,10 @@ export function getPrompts(filter: t.TPromptsWithFilterRequest): Promise<t.TProm
|
|||
return request.get(endpoints.getPromptsWithFilters(filter));
|
||||
}
|
||||
|
||||
export function getAllPromptGroups(): Promise<q.AllPromptGroupsResponse> {
|
||||
return request.get(endpoints.getAllPromptGroups());
|
||||
}
|
||||
|
||||
export function getPromptGroups(
|
||||
filter: t.TPromptGroupsWithFilterRequest,
|
||||
): Promise<t.PromptGroupListResponse> {
|
||||
|
|
|
|||
|
|
@ -30,6 +30,7 @@ export enum QueryKeys {
|
|||
prompts = 'prompts',
|
||||
prompt = 'prompt',
|
||||
promptGroups = 'promptGroups',
|
||||
allPromptGroups = 'allPromptGroups',
|
||||
promptGroup = 'promptGroup',
|
||||
categories = 'categories',
|
||||
randomPrompts = 'randomPrompts',
|
||||
|
|
|
|||
|
|
@ -351,6 +351,7 @@ export type TPrompt = {
|
|||
export type TPromptGroup = {
|
||||
name: string;
|
||||
numberOfGenerations?: number;
|
||||
command?: string;
|
||||
oneliner?: string;
|
||||
category?: string;
|
||||
projectIds?: string[];
|
||||
|
|
@ -365,7 +366,7 @@ export type TPromptGroup = {
|
|||
|
||||
export type TCreatePrompt = {
|
||||
prompt: Pick<TPrompt, 'prompt' | 'type'> & { groupId?: string };
|
||||
group?: { name: string; category?: string; oneliner?: string };
|
||||
group?: { name: string; category?: string; oneliner?: string; command?: string };
|
||||
};
|
||||
|
||||
export type TCreatePromptRecord = TCreatePrompt & Pick<TPromptGroup, 'author' | 'authorName'>;
|
||||
|
|
@ -385,6 +386,7 @@ export type TPromptGroupsWithFilterRequest = {
|
|||
after?: string | null;
|
||||
order?: 'asc' | 'desc';
|
||||
name?: string;
|
||||
author?: string;
|
||||
};
|
||||
|
||||
export type PromptGroupListResponse = {
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
import type { InfiniteData } from '@tanstack/react-query';
|
||||
import type { TMessage, TConversation, TSharedLink } from '../schemas';
|
||||
import type * as t from '../types';
|
||||
export type Conversation = {
|
||||
id: string;
|
||||
createdAt: number;
|
||||
|
|
@ -54,3 +55,16 @@ export type SharedLinkListResponse = {
|
|||
};
|
||||
|
||||
export type SharedLinkListData = InfiniteData<SharedLinkListResponse>;
|
||||
|
||||
export type AllPromptGroupsFilterRequest = {
|
||||
category: string;
|
||||
pageNumber: string;
|
||||
pageSize: string | number;
|
||||
before?: string | null;
|
||||
after?: string | null;
|
||||
order?: 'asc' | 'desc';
|
||||
name?: string;
|
||||
author?: string;
|
||||
};
|
||||
|
||||
export type AllPromptGroupsResponse = t.TPromptGroup[];
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue