mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-12-19 09:50:15 +01:00
🔒 feat: RBAC for Multi-Convo Feature (#3964)
* fix: remove duplicate keys in German language translations * wip: multi-convo role permissions * ci: Update loadDefaultInterface tests due to MULTI_CONVO * ci: update Role.spec.js with tests for MULTI_CONVO permission type * fix: Update ContentParts component to handle undefined content array * feat: render Multi-Convo based on UI permissions
This commit is contained in:
parent
d59b62174f
commit
748b41eda4
18 changed files with 302 additions and 56 deletions
|
|
@ -46,10 +46,14 @@ const useHandleKeyUp = ({
|
|||
setShowPlusPopover: SetterOrUpdater<boolean>;
|
||||
setShowMentionPopover: SetterOrUpdater<boolean>;
|
||||
}) => {
|
||||
const hasAccess = useHasAccess({
|
||||
const hasPromptsAccess = useHasAccess({
|
||||
permissionType: PermissionTypes.PROMPTS,
|
||||
permission: Permissions.USE,
|
||||
});
|
||||
const hasMultiConvoAccess = useHasAccess({
|
||||
permissionType: PermissionTypes.MULTI_CONVO,
|
||||
permission: Permissions.USE,
|
||||
});
|
||||
const setShowPromptsPopover = useSetRecoilState(store.showPromptsPopoverFamily(index));
|
||||
|
||||
// Get the current state of command toggles
|
||||
|
|
@ -64,19 +68,22 @@ const useHandleKeyUp = ({
|
|||
}, [textAreaRef, setShowMentionPopover, atCommandEnabled]);
|
||||
|
||||
const handlePlusCommand = useCallback(() => {
|
||||
if (plusCommandEnabled && shouldTriggerCommand(textAreaRef, '+')) {
|
||||
if (!hasMultiConvoAccess || !plusCommandEnabled) {
|
||||
return;
|
||||
}
|
||||
if (shouldTriggerCommand(textAreaRef, '+')) {
|
||||
setShowPlusPopover(true);
|
||||
}
|
||||
}, [textAreaRef, setShowPlusPopover, plusCommandEnabled]);
|
||||
}, [textAreaRef, setShowPlusPopover, plusCommandEnabled, hasMultiConvoAccess]);
|
||||
|
||||
const handlePromptsCommand = useCallback(() => {
|
||||
if (!hasAccess || !slashCommandEnabled) {
|
||||
if (!hasPromptsAccess || !slashCommandEnabled) {
|
||||
return;
|
||||
}
|
||||
if (shouldTriggerCommand(textAreaRef, '/')) {
|
||||
setShowPromptsPopover(true);
|
||||
}
|
||||
}, [textAreaRef, hasAccess, setShowPromptsPopover, slashCommandEnabled]);
|
||||
}, [textAreaRef, hasPromptsAccess, setShowPromptsPopover, slashCommandEnabled]);
|
||||
|
||||
const commandHandlers = useMemo(
|
||||
() => ({
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue