Skip to content

Commit

Permalink
/onResponseCompletion fix
Browse files Browse the repository at this point in the history
  • Loading branch information
star-nox committed Feb 28, 2024
1 parent ef4c016 commit 20e048c
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions ai_ta_backend/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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
Expand Down

0 comments on commit 20e048c

Please sign in to comment.