mirror of
https://github.com/danny-avila/LibreChat.git
synced 2026-03-11 10:32:37 +01:00
🥷 fix: Correct Agents Handling for Marketplace Users (#9065)
* refactor: Introduce ModelSelectorChatContext and integrate with ModelSelector * fix: agents handling in ModelSelector to show expected agents if user has marketplace access
This commit is contained in:
parent
e4e25aaf2b
commit
d57e7aec73
8 changed files with 124 additions and 57 deletions
|
|
@ -9,7 +9,7 @@ export default function useAgentsMap({
|
|||
}: {
|
||||
isAuthenticated: boolean;
|
||||
}): TAgentsMap | undefined {
|
||||
const { data: agentsList = null } = useListAgentsQuery(
|
||||
const { data: mappedAgents = null } = useListAgentsQuery(
|
||||
{ requiredPermission: PermissionBits.VIEW },
|
||||
{
|
||||
select: (res) => mapAgents(res.data),
|
||||
|
|
@ -17,9 +17,9 @@ export default function useAgentsMap({
|
|||
},
|
||||
);
|
||||
|
||||
const agents = useMemo<TAgentsMap | undefined>(() => {
|
||||
return agentsList !== null ? agentsList : undefined;
|
||||
}, [agentsList]);
|
||||
const agentsMap = useMemo<TAgentsMap | undefined>(() => {
|
||||
return mappedAgents !== null ? mappedAgents : undefined;
|
||||
}, [mappedAgents]);
|
||||
|
||||
return agents;
|
||||
return agentsMap;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue