From 20e048c59eef78715d9e02307a2d49497a1a845e Mon Sep 17 00:00:00 2001 From: star-nox Date: Wed, 28 Feb 2024 11:20:59 -0600 Subject: [PATCH] /onResponseCompletion fix --- ai_ta_backend/main.py | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/ai_ta_backend/main.py b/ai_ta_backend/main.py index 60d423a8..dae7ef0e 100644 --- a/ai_ta_backend/main.py +++ b/ai_ta_backend/main.py @@ -578,12 +578,9 @@ def createDocumentMap(): @app.route('/onResponseCompletion', methods=['POST']) def logToNomic(): - # data = request.get_json() - # course_name = data['course_name'] - # conversation = data['conversation'] - - course_name: str = request.args.get('course_name', default='', type=str) - conversation: str = request.args.get('conversation', default='', type=str) + data = request.get_json() + course_name = data['course_name'] + conversation = data['conversation'] if course_name == '' or conversation == '': # proper web error "400 Bad request" @@ -595,8 +592,7 @@ def logToNomic(): print(f"In /onResponseCompletion for course: {course_name}") # background execution of tasks!! - #response = executor.submit(log_convo_to_nomic, course_name, data) - response = executor.submit(log_convo_to_nomic, course_name, conversation) + response = executor.submit(log_convo_to_nomic, course_name, data) response = jsonify({'outcome': 'success'}) response.headers.add('Access-Control-Allow-Origin', '*') return response