mirror of
https://github.com/danny-avila/LibreChat.git
synced 2026-02-11 20:14:24 +01:00
refactor: Replace marketplace interface config with permission-based system
- Add MARKETPLACE permission type to handle marketplace access control - Update interface configuration to use role-based marketplace settings (admin/user) - Replace direct marketplace boolean config with permission-based checks - Modify frontend components to use marketplace permissions instead of interface config - Update agent query hooks to use marketplace permissions for determining permission levels - Add marketplace configuration structure similar to peoplePicker in YAML config - Backend now sets MARKETPLACE permissions based on interface configuration - When marketplace enabled: users get agents with EDIT permissions in dropdown lists (builder mode) - When marketplace disabled: users get agents with VIEW permissions in dropdown lists (browse mode)
This commit is contained in:
parent
ce3dbf8609
commit
f20209ecc5
12 changed files with 128 additions and 15 deletions
|
|
@ -1,6 +1,6 @@
|
|||
import { PERMISSION_BITS, TAgentsMap } from 'librechat-data-provider';
|
||||
import { TAgentsMap } from 'librechat-data-provider';
|
||||
import { useMemo } from 'react';
|
||||
import { useListAgentsQuery } from '~/data-provider';
|
||||
import { useListAgentsQuery, useAgentListingDefaultPermissionLevel } from '~/data-provider';
|
||||
import { mapAgents } from '~/utils';
|
||||
|
||||
export default function useAgentsMap({
|
||||
|
|
@ -8,8 +8,10 @@ export default function useAgentsMap({
|
|||
}: {
|
||||
isAuthenticated: boolean;
|
||||
}): TAgentsMap | undefined {
|
||||
const permissionLevel = useAgentListingDefaultPermissionLevel();
|
||||
|
||||
const { data: agentsList = null } = useListAgentsQuery(
|
||||
{ requiredPermission: PERMISSION_BITS.EDIT },
|
||||
{ requiredPermission: permissionLevel },
|
||||
{
|
||||
select: (res) => mapAgents(res.data),
|
||||
enabled: isAuthenticated,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue