Spaces:
Runtime error
Runtime error
Greg Thompson
commited on
Commit
•
cbbb51a
1
Parent(s):
5cdb1ff
Add users.json data, data-driven quiz test, and data-driven quiz call
Browse files- app.py +2 -0
- mathtext_fastapi/v2_conversation_manager.py +1 -2
- scripts/make_request.py +6 -0
- users.json +1 -0
app.py
CHANGED
@@ -162,10 +162,12 @@ async def num_one(request: Request):
|
|
162 |
'state': 'question'
|
163 |
}
|
164 |
"""
|
|
|
165 |
data_dict = await request.json()
|
166 |
message_data = ast.literal_eval(data_dict.get('message_data', '').get('message_body', ''))
|
167 |
user_id = message_data['user_id']
|
168 |
message_text = message_data['message_text']
|
|
|
169 |
return num_one_quiz.process_user_message(user_id, message_text)
|
170 |
|
171 |
|
|
|
162 |
'state': 'question'
|
163 |
}
|
164 |
"""
|
165 |
+
print("STEP 1")
|
166 |
data_dict = await request.json()
|
167 |
message_data = ast.literal_eval(data_dict.get('message_data', '').get('message_body', ''))
|
168 |
user_id = message_data['user_id']
|
169 |
message_text = message_data['message_text']
|
170 |
+
print("STEP 2")
|
171 |
return num_one_quiz.process_user_message(user_id, message_text)
|
172 |
|
173 |
|
mathtext_fastapi/v2_conversation_manager.py
CHANGED
@@ -122,8 +122,7 @@ def retrieve_microlesson_content(context_data, user_message, microlesson, contac
|
|
122 |
'state': state_label
|
123 |
}
|
124 |
elif microlesson == 'addition2':
|
125 |
-
|
126 |
-
# message_package = num_one.process_user_message(user_id, message_text, state)
|
127 |
elif context_data['local_state'] == 'subtraction-question-sequence' or \
|
128 |
user_message == 'subtract' or \
|
129 |
microlesson == 'subtraction':
|
|
|
122 |
'state': state_label
|
123 |
}
|
124 |
elif microlesson == 'addition2':
|
125 |
+
message_package = num_one.process_user_message(contact_uuid, user_message)
|
|
|
126 |
elif context_data['local_state'] == 'subtraction-question-sequence' or \
|
127 |
user_message == 'subtract' or \
|
128 |
microlesson == 'subtraction':
|
scripts/make_request.py
CHANGED
@@ -103,6 +103,12 @@ def run_simulated_request(endpoint, sample_answer, context=None):
|
|
103 |
# 'difficulty': 0.01,
|
104 |
# 'do_increase': False # True | False
|
105 |
# })
|
|
|
|
|
|
|
|
|
|
|
|
|
106 |
run_simulated_request("num_one", {
|
107 |
"user_id": "1",
|
108 |
"message_text": "61",
|
|
|
103 |
# 'difficulty': 0.01,
|
104 |
# 'do_increase': False # True | False
|
105 |
# })
|
106 |
+
# Need to start with this command to populate users.json
|
107 |
+
# If users.json is not already made
|
108 |
+
# run_simulated_request("num_one", {
|
109 |
+
# "user_id": "1",
|
110 |
+
# "message_text": "",
|
111 |
+
# })
|
112 |
run_simulated_request("num_one", {
|
113 |
"user_id": "1",
|
114 |
"message_text": "61",
|
users.json
CHANGED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
{"1": {"skill_score": 0.04, "state": "question", "start": 3, "stop": 3, "step": 1, "answer": 4}}
|