From 476a0478c88e593fc1cb070a2960a98690779ec8 Mon Sep 17 00:00:00 2001 From: Ismail Pelaseyed Date: Wed, 26 Jul 2023 23:22:16 +0200 Subject: [PATCH] Fix issue with sharing agents --- app/api/agents.py | 2 +- ui/app/_components/providers.js | 6 ++---- ui/app/agents/[agentId]/_components/nav.js | 2 +- 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/app/api/agents.py b/app/api/agents.py index 2309b368c..90386662a 100644 --- a/app/api/agents.py +++ b/app/api/agents.py @@ -102,7 +102,7 @@ async def delete_agent(agentId: str, token=Depends(JWTBearer())): ) async def patch_agent(agentId: str, body: dict, token=Depends(JWTBearer())): """Patch agent endpoint""" - tags = body["tags"] + tags = body.get("tags") if tags or tags == []: body["tags"] = json.dumps(tags) diff --git a/ui/app/_components/providers.js b/ui/app/_components/providers.js index d6afd45cf..d3992ce1a 100644 --- a/ui/app/_components/providers.js +++ b/ui/app/_components/providers.js @@ -25,7 +25,7 @@ function AnalyticsProvider({ children }) { session.status === "authenticated" && previousSession?.status !== "authenticated" ) { - analytics.identify(session.data.user.user.id, { + analytics.identify(session.data.user?.user?.id, { ...session.data.user.user, }); } @@ -40,9 +40,7 @@ export function Providers({ children }) { - - {children} - + {children} diff --git a/ui/app/agents/[agentId]/_components/nav.js b/ui/app/agents/[agentId]/_components/nav.js index 8ee81f146..e4208fd21 100644 --- a/ui/app/agents/[agentId]/_components/nav.js +++ b/ui/app/agents/[agentId]/_components/nav.js @@ -50,7 +50,7 @@ export default function AgentNavbar({ agent, apiToken, hasApiTokenWarning }) { const api = new API(session.data); - await api.patchAgent({ id: agent.id, isPublic: event.target.checked }); + await api.patchAgent(agent.id, { isPublic: event.target.checked }); router.refresh(); setIsChangingShareStatus();