🗨️ 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:
Danny Avila 2024-06-27 17:34:48 -04:00 committed by GitHub
parent b8f2bee3fc
commit 83619de158
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
33 changed files with 764 additions and 80 deletions

View file

@ -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()}`;

View file

@ -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 {

View file

@ -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> {

View file

@ -30,6 +30,7 @@ export enum QueryKeys {
prompts = 'prompts',
prompt = 'prompt',
promptGroups = 'promptGroups',
allPromptGroups = 'allPromptGroups',
promptGroup = 'promptGroup',
categories = 'categories',
randomPrompts = 'randomPrompts',

View file

@ -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 = {

View file

@ -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[];