Skip to content

Commit

Permalink
reverted json structure changes in main
Browse files Browse the repository at this point in the history
  • Loading branch information
star-nox committed Nov 2, 2023
1 parent 489f380 commit 3b3f2fb
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions ai_ta_backend/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -448,12 +448,13 @@ def nomic_map():

@app.route('/onResponseCompletion', methods=['POST'])
def logToNomic():
# data = request.get_json()
# course_name = data['course_name']
# conversation = data['conversation']

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)
#course_name: str = request.args.get('course_name', default='', type=str)
#conversation: str = request.args.get('conversation', default='', type=str)

if course_name == '' or conversation == '':
# proper web error "400 Bad request"
Expand All @@ -465,8 +466,8 @@ 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 = executor.submit(log_convo_to_nomic, course_name, conversation)
response = jsonify({'outcome': 'success'})
response.headers.add('Access-Control-Allow-Origin', '*')
return response
Expand Down

0 comments on commit 3b3f2fb

Please sign in to comment.