mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-12-20 10:20:15 +01:00
🔖 feat: Enhance Bookmarks UX, add RBAC, toggle via librechat.yaml (#3747)
* chore: update package version to 0.7.416 * chore: Update Role.js imports order * refactor: move updateTagsInConvo to tags route, add RBAC for tags * refactor: add updateTagsInConvoOptions * fix: loading state for bookmark form * refactor: update primaryText class in TitleButton component * refactor: remove duplicate bookmarks and theming * refactor: update EditIcon component to use React.forwardRef * refactor: add _id field to tConversationTagSchema * refactor: remove promises * refactor: move mutation logic from BookmarkForm -> BookmarkEditDialog * refactor: update button class in BookmarkForm component * fix: conversation mutations and add better logging to useConversationTagMutation * refactor: update logger message in BookmarkEditDialog component * refactor: improve UI consistency in BookmarkNav and NewChat components * refactor: update logger message in BookmarkEditDialog component * refactor: Add tags prop to BookmarkForm component * refactor: Update BookmarkForm to avoid tag mutation if the tag already exists; also close dialog on submission programmatically * refactor: general role helper function to support updating access permissions for different permission types * refactor: Update getLatestText function to handle undefined values in message.content * refactor: Update useHasAccess hook to handle null role values for authenticated users * feat: toggle bookmarks access * refactor: Update PromptsCommand to handle access permissions for prompts * feat: updateConversationSelector * refactor: rename `vars` to `tagToDelete` for clarity * fix: prevent recreation of deleted tags in BookmarkMenu on Item Click * ci: mock updateBookmarksAccess function * ci: mock updateBookmarksAccess function
This commit is contained in:
parent
366e4c5adb
commit
f86e9dd04c
39 changed files with 530 additions and 298 deletions
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "librechat-data-provider",
|
||||
"version": "0.7.415",
|
||||
"version": "0.7.416",
|
||||
"description": "data services for librechat apps",
|
||||
"main": "dist/index.js",
|
||||
"module": "dist/index.es.js",
|
||||
|
|
|
|||
|
|
@ -201,4 +201,4 @@ export const conversationTagsList = (pageNumber: string, sort?: string, order?:
|
|||
}`;
|
||||
|
||||
export const addTagToConversation = (conversationId: string) =>
|
||||
`${conversationsRoot}/tags/${conversationId}`;
|
||||
`${conversationTags()}/convo/${conversationId}`;
|
||||
|
|
|
|||
|
|
@ -413,6 +413,7 @@ export const configSchema = z.object({
|
|||
modelSelect: z.boolean().optional(),
|
||||
parameters: z.boolean().optional(),
|
||||
sidePanel: z.boolean().optional(),
|
||||
bookmarks: z.boolean().optional(),
|
||||
presets: z.boolean().optional(),
|
||||
prompts: z.boolean().optional(),
|
||||
})
|
||||
|
|
|
|||
|
|
@ -22,6 +22,10 @@ export enum PermissionTypes {
|
|||
* Type for Prompt Permissions
|
||||
*/
|
||||
PROMPTS = 'PROMPTS',
|
||||
/**
|
||||
* Type for Bookmarks Permissions
|
||||
*/
|
||||
BOOKMARKS = 'BOOKMARKS',
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -41,13 +45,19 @@ export const promptPermissionsSchema = z.object({
|
|||
[Permissions.SHARE]: z.boolean().default(false),
|
||||
});
|
||||
|
||||
export const bookmarkPermissionsSchema = z.object({
|
||||
[Permissions.USE]: z.boolean().default(true),
|
||||
});
|
||||
|
||||
export const roleSchema = z.object({
|
||||
name: z.string(),
|
||||
[PermissionTypes.PROMPTS]: promptPermissionsSchema,
|
||||
[PermissionTypes.BOOKMARKS]: bookmarkPermissionsSchema,
|
||||
});
|
||||
|
||||
export type TRole = z.infer<typeof roleSchema>;
|
||||
export type TPromptPermissions = z.infer<typeof promptPermissionsSchema>;
|
||||
export type TBookmarkPermissions = z.infer<typeof bookmarkPermissionsSchema>;
|
||||
|
||||
const defaultRolesSchema = z.object({
|
||||
[SystemRoles.ADMIN]: roleSchema.extend({
|
||||
|
|
@ -58,10 +68,14 @@ const defaultRolesSchema = z.object({
|
|||
[Permissions.CREATE]: z.boolean().default(true),
|
||||
[Permissions.SHARE]: z.boolean().default(true),
|
||||
}),
|
||||
[PermissionTypes.BOOKMARKS]: bookmarkPermissionsSchema.extend({
|
||||
[Permissions.USE]: z.boolean().default(true),
|
||||
}),
|
||||
}),
|
||||
[SystemRoles.USER]: roleSchema.extend({
|
||||
name: z.literal(SystemRoles.USER),
|
||||
[PermissionTypes.PROMPTS]: promptPermissionsSchema,
|
||||
[PermissionTypes.BOOKMARKS]: bookmarkPermissionsSchema,
|
||||
}),
|
||||
});
|
||||
|
||||
|
|
@ -69,9 +83,11 @@ export const roleDefaults = defaultRolesSchema.parse({
|
|||
[SystemRoles.ADMIN]: {
|
||||
name: SystemRoles.ADMIN,
|
||||
[PermissionTypes.PROMPTS]: {},
|
||||
[PermissionTypes.BOOKMARKS]: {},
|
||||
},
|
||||
[SystemRoles.USER]: {
|
||||
name: SystemRoles.USER,
|
||||
[PermissionTypes.PROMPTS]: {},
|
||||
[PermissionTypes.BOOKMARKS]: {},
|
||||
},
|
||||
});
|
||||
|
|
|
|||
|
|
@ -481,6 +481,7 @@ export const tSharedLinkSchema = z.object({
|
|||
export type TSharedLink = z.infer<typeof tSharedLinkSchema>;
|
||||
|
||||
export const tConversationTagSchema = z.object({
|
||||
_id: z.string(),
|
||||
user: z.string(),
|
||||
tag: z.string(),
|
||||
description: z.string().optional(),
|
||||
|
|
|
|||
|
|
@ -105,6 +105,12 @@ export type CreateSharedLinkOptions = MutationOptions<
|
|||
types.TSharedLink,
|
||||
Partial<types.TSharedLink>
|
||||
>;
|
||||
|
||||
export type updateTagsInConvoOptions = MutationOptions<
|
||||
types.TTagConversationResponse,
|
||||
types.TTagConversationRequest
|
||||
>;
|
||||
|
||||
export type UpdateSharedLinkOptions = MutationOptions<
|
||||
types.TSharedLink,
|
||||
Partial<types.TSharedLink>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue