From f8f6c6e8cbb3534999ab1e6312410deff58a2f06 Mon Sep 17 00:00:00 2001 From: star-nox Date: Wed, 28 Feb 2024 11:35:45 -0600 Subject: [PATCH 1/3] testing data type in log function --- ai_ta_backend/nomic_logging.py | 1 + 1 file changed, 1 insertion(+) diff --git a/ai_ta_backend/nomic_logging.py b/ai_ta_backend/nomic_logging.py index 146b572c..39c24705 100644 --- a/ai_ta_backend/nomic_logging.py +++ b/ai_ta_backend/nomic_logging.py @@ -80,6 +80,7 @@ def log_convo_to_nomic(course_name: str, conversation) -> str: print(f"in log_convo_to_nomic() for course: {course_name}") print("type of conversation:", type(conversation)) + print("conversation:", conversation) #conversation = json.loads(conversation) messages = conversation['conversation']['messages'] user_email = conversation['conversation']['user_email'] From 902edf83b80efa1bd062d4930afc67ee34c3baaa Mon Sep 17 00:00:00 2001 From: star-nox Date: Wed, 28 Feb 2024 13:05:13 -0600 Subject: [PATCH 2/3] 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 From eeff121ca5858b4d545c3a66248219699fc55a43 Mon Sep 17 00:00:00 2001 From: star-nox Date: Wed, 28 Feb 2024 13:15:55 -0600 Subject: [PATCH 3/3] removed test print statements --- ai_ta_backend/nomic_logging.py | 1 - 1 file changed, 1 deletion(-) diff --git a/ai_ta_backend/nomic_logging.py b/ai_ta_backend/nomic_logging.py index 72e385cd..cf5bc699 100644 --- a/ai_ta_backend/nomic_logging.py +++ b/ai_ta_backend/nomic_logging.py @@ -80,7 +80,6 @@ def log_convo_to_nomic(course_name: str, conversation) -> str: print(f"in log_convo_to_nomic() for course: {course_name}") print("type of conversation:", type(conversation)) - print("conversation:", conversation) #conversation = json.loads(conversation) messages = conversation['conversation']['messages'] if 'user_email' not in conversation['conversation']: