Spaces:
Runtime error
Runtime error
Greg Thompson
commited on
Commit
·
8d4dd70
1
Parent(s):
28c0a86
Update to handle context in request
Browse files- app.py +2 -1
- mathtext_fastapi/conversation_manager.py +2 -2
app.py
CHANGED
|
@@ -56,8 +56,9 @@ async def programmatic_message_manager(request: Request):
|
|
| 56 |
|
| 57 |
data_dict = await request.json()
|
| 58 |
message_data = data_dict.get('message_data', '')
|
|
|
|
| 59 |
|
| 60 |
-
context = generate_message(message_data)
|
| 61 |
return JSONResponse(context)
|
| 62 |
|
| 63 |
@app.post("/nlu")
|
|
|
|
| 56 |
|
| 57 |
data_dict = await request.json()
|
| 58 |
message_data = data_dict.get('message_data', '')
|
| 59 |
+
context_data = data_dict.get('context', '')
|
| 60 |
|
| 61 |
+
context = generate_message(message_data, context_data)
|
| 62 |
return JSONResponse(context)
|
| 63 |
|
| 64 |
@app.post("/nlu")
|
mathtext_fastapi/conversation_manager.py
CHANGED
|
@@ -9,7 +9,7 @@ load_dotenv()
|
|
| 9 |
# os.environ.get('SUPABASE_URL')
|
| 10 |
|
| 11 |
|
| 12 |
-
def generate_message(data_json):
|
| 13 |
""" pending
|
| 14 |
|
| 15 |
REQUIREMENTS
|
|
@@ -143,6 +143,6 @@ def generate_message(data_json):
|
|
| 143 |
print("==================")
|
| 144 |
|
| 145 |
|
| 146 |
-
context = {"
|
| 147 |
|
| 148 |
return context
|
|
|
|
| 9 |
# os.environ.get('SUPABASE_URL')
|
| 10 |
|
| 11 |
|
| 12 |
+
def generate_message(data_json, context_data):
|
| 13 |
""" pending
|
| 14 |
|
| 15 |
REQUIREMENTS
|
|
|
|
| 143 |
print("==================")
|
| 144 |
|
| 145 |
|
| 146 |
+
context = {"context":{"user":"Alan", "state": "received-and-replied-state"}}
|
| 147 |
|
| 148 |
return context
|