⚙️ fix: minor issues related to agents (#4297)

* chore: deprecate `web-browser` tool

* fix: edit agent permission
This commit is contained in:
Danny Avila 2024-10-01 11:11:15 -04:00 committed by GitHub
parent 2ce8647540
commit 2ca257dfb9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 15 additions and 24 deletions

View file

@ -174,15 +174,25 @@ export default function AgentPanel({
}
}, [agent_id, onSelectAgent]);
const canEditAgent = useMemo(() => {
const canEdit =
agentQuery.data?.isCollaborative ?? false
? true
: agentQuery.data?.author === user?.id || user?.role === SystemRoles.ADMIN;
return agentQuery.data?.id != null && agentQuery.data.id ? canEdit : true;
}, [
agentQuery.data?.isCollaborative,
agentQuery.data?.author,
agentQuery.data?.id,
user?.id,
user?.role,
]);
if (agentQuery.isInitialLoading) {
return <AgentPanelSkeleton />;
}
const canEditAgent =
agentQuery.data?.isCollaborative ?? false
? true
: agentQuery.data?.author === user?.id || user?.role === SystemRoles.ADMIN;
return (
<FormProvider {...methods}>
<form