From 902edf83b80efa1bd062d4930afc67ee34c3baaa Mon Sep 17 00:00:00 2001 From: star-nox Date: Wed, 28 Feb 2024 13:05:13 -0600 Subject: [PATCH] added condition when user email is unavailable --- ai_ta_backend/nomic_logging.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ai_ta_backend/nomic_logging.py b/ai_ta_backend/nomic_logging.py index 39c24705..72e385cd 100644 --- a/ai_ta_backend/nomic_logging.py +++ b/ai_ta_backend/nomic_logging.py @@ -83,7 +83,10 @@ def log_convo_to_nomic(course_name: str, conversation) -> str: print("conversation:", conversation) #conversation = json.loads(conversation) messages = conversation['conversation']['messages'] - user_email = conversation['conversation']['user_email'] + if 'user_email' not in conversation['conversation']: + user_email = "NULL" + else: + user_email = conversation['conversation']['user_email'] conversation_id = conversation['conversation']['id'] # we have to upload whole conversations