mirror of
https://github.com/danny-avila/LibreChat.git
synced 2026-01-21 01:36:13 +01:00
✨ feat: Add user prompt preferences and favorites functionality
This commit is contained in:
parent
f2f4bf87ca
commit
0e26df0390
16 changed files with 788 additions and 54 deletions
|
|
@ -250,6 +250,13 @@ export const getCategories = () => '/api/categories';
|
|||
|
||||
export const getAllPromptGroups = () => `${prompts()}/all`;
|
||||
|
||||
/* Prompt Favorites and Rankings */
|
||||
export const togglePromptFavorite = (groupId: string) => `${prompts()}/favorites/${groupId}`;
|
||||
|
||||
export const updatePromptRankings = () => `${prompts()}/rankings`;
|
||||
|
||||
export const getUserPromptPreferences = () => `${prompts()}/preferences`;
|
||||
|
||||
/* Roles */
|
||||
export const roles = () => '/api/roles';
|
||||
export const getRole = (roleName: string) => `${roles()}/${roleName.toLowerCase()}`;
|
||||
|
|
|
|||
|
|
@ -701,6 +701,21 @@ export function getRandomPrompts(
|
|||
return request.get(endpoints.getRandomPrompts(variables.limit, variables.skip));
|
||||
}
|
||||
|
||||
/* Prompt Favorites and Rankings */
|
||||
export function togglePromptFavorite(groupId: string): Promise<t.TPromptFavoriteResponse> {
|
||||
return request.post(endpoints.togglePromptFavorite(groupId));
|
||||
}
|
||||
|
||||
export function updatePromptRankings(
|
||||
variables: t.TPromptRankingRequest,
|
||||
): Promise<t.TPromptRankingResponse> {
|
||||
return request.put(endpoints.updatePromptRankings(), variables);
|
||||
}
|
||||
|
||||
export function getUserPromptPreferences(): Promise<t.TGetUserPromptPreferencesResponse> {
|
||||
return request.get(endpoints.getUserPromptPreferences());
|
||||
}
|
||||
|
||||
/* Roles */
|
||||
export function getRole(roleName: string): Promise<r.TRole> {
|
||||
return request.get(endpoints.getRole(roleName));
|
||||
|
|
|
|||
|
|
@ -39,6 +39,7 @@ export enum QueryKeys {
|
|||
promptGroups = 'promptGroups',
|
||||
allPromptGroups = 'allPromptGroups',
|
||||
promptGroup = 'promptGroup',
|
||||
userPromptPreferences = 'userPromptPreferences',
|
||||
categories = 'categories',
|
||||
randomPrompts = 'randomPrompts',
|
||||
roles = 'roles',
|
||||
|
|
|
|||
|
|
@ -537,6 +537,39 @@ export type TGetRandomPromptsRequest = {
|
|||
skip: number;
|
||||
};
|
||||
|
||||
/** Prompt favorites and ranking types */
|
||||
export type TPromptFavoriteRequest = {
|
||||
promptGroupId: string;
|
||||
};
|
||||
|
||||
export type TPromptFavoriteResponse = {
|
||||
promptGroupId: string;
|
||||
isFavorite: boolean;
|
||||
};
|
||||
|
||||
export type TPromptRankingRequest = {
|
||||
rankings: Array<{
|
||||
promptGroupId: string;
|
||||
order: number;
|
||||
}>;
|
||||
};
|
||||
|
||||
export type TPromptRankingResponse = {
|
||||
message: string;
|
||||
rankings: Array<{
|
||||
promptGroupId: string;
|
||||
order: number;
|
||||
}>;
|
||||
};
|
||||
|
||||
export type TGetUserPromptPreferencesResponse = {
|
||||
favorites: string[];
|
||||
rankings: Array<{
|
||||
promptGroupId: string;
|
||||
order: number;
|
||||
}>;
|
||||
};
|
||||
|
||||
export type TCustomConfigSpeechResponse = { [key: string]: string };
|
||||
|
||||
export type TUserTermsResponse = {
|
||||
|
|
@ -557,7 +590,7 @@ export type TUpdateFeedbackResponse = {
|
|||
messageId: string;
|
||||
conversationId: string;
|
||||
feedback?: TMinimalFeedback;
|
||||
}
|
||||
};
|
||||
|
||||
export type TBalanceResponse = {
|
||||
tokenCredits: number;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue