From e37ed257a7ba87a358351bd626b68ea2358dc269 Mon Sep 17 00:00:00 2001 From: Willy Douhard Date: Tue, 7 Nov 2023 15:25:36 +0100 Subject: [PATCH] fix get_conversation_author --- backend/chainlit/client/cloud.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/backend/chainlit/client/cloud.py b/backend/chainlit/client/cloud.py index 03f8ba4367..50d36c3471 100644 --- a/backend/chainlit/client/cloud.py +++ b/backend/chainlit/client/cloud.py @@ -167,11 +167,11 @@ async def get_conversation_author(self, conversation_id: str) -> Optional[str]: } res = await self.query(query, variables) self.check_for_errors(res, raise_error=True) - app_user = res.get("data", {}).get("conversation", {}).get("appUser") - if app_user: - return app_user.get("username") - else: - return None + data = res.get("data") + conversation = data.get("conversation") if data else None + return ( + conversation["appUser"].get("username") if conversation["appUser"] else None + ) async def get_conversation(self, conversation_id: str) -> ConversationDict: query = """