mirror of
https://github.com/danny-avila/LibreChat.git
synced 2026-01-16 15:35:31 +01:00
👁️🗨️ refactor: use PermissionBits.VIEW in useAgentsMap for requiredPermission
This commit is contained in:
parent
803ade8601
commit
b742c8c7f9
7 changed files with 32 additions and 36 deletions
|
|
@ -1,33 +1,11 @@
|
|||
import {
|
||||
QueryKeys,
|
||||
dataService,
|
||||
Permissions,
|
||||
EModelEndpoint,
|
||||
PermissionBits,
|
||||
PermissionTypes,
|
||||
} from 'librechat-data-provider';
|
||||
import { useQuery, useInfiniteQuery, useQueryClient } from '@tanstack/react-query';
|
||||
import { QueryKeys, dataService, EModelEndpoint, PermissionBits } from 'librechat-data-provider';
|
||||
import type {
|
||||
QueryObserverResult,
|
||||
UseQueryOptions,
|
||||
UseInfiniteQueryOptions,
|
||||
} from '@tanstack/react-query';
|
||||
import type t from 'librechat-data-provider';
|
||||
import { useHasAccess } from '~/hooks';
|
||||
|
||||
/**
|
||||
* Hook to determine the appropriate permission level for agent queries based on marketplace configuration
|
||||
*/
|
||||
export const useAgentListingDefaultPermissionLevel = () => {
|
||||
const hasMarketplaceAccess = useHasAccess({
|
||||
permissionType: PermissionTypes.MARKETPLACE,
|
||||
permission: Permissions.USE,
|
||||
});
|
||||
|
||||
// When marketplace is active: EDIT permissions (builder mode)
|
||||
// When marketplace is not active: VIEW permissions (browse mode)
|
||||
return hasMarketplaceAccess ? PermissionBits.EDIT : PermissionBits.VIEW;
|
||||
};
|
||||
|
||||
/**
|
||||
* AGENTS
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue