Greg Thompson commited on
Commit
836e833
1 Parent(s): 8f1bf52

Update nlu api to remove author_id before saving to db

Browse files
Files changed (2) hide show
  1. app.py +8 -7
  2. mathtext_fastapi/nlu.py +3 -0
app.py CHANGED
@@ -58,13 +58,14 @@ async def programmatic_message_manager(request: Request):
58
  Input
59
  request.body: dict - a json object of message data for the most recent user response
60
  {
61
- author_id: "+47897891",
62
- author_type: "OWNER",
63
- message_body: "a test message",
64
- message_direction: "inbound",
65
- message_id: "ABJAK64jlk3-agjkl2QHFAFH",
66
- message_inserted_at: "2022-07-05T04:00:34.03352Z",
67
- message_updated_at: "2023-02-14T03:54:19.342950Z",
 
68
  }
69
 
70
  Output
 
58
  Input
59
  request.body: dict - a json object of message data for the most recent user response
60
  {
61
+ "author_id": "+47897891",
62
+ "contact_uuid": "j43hk26-2hjl-43jk-hnk2-k4ljl46j0ds09",
63
+ "author_type": "OWNER",
64
+ "message_body": "a test message",
65
+ "message_direction": "inbound",
66
+ "message_id": "ABJAK64jlk3-agjkl2QHFAFH",
67
+ "message_inserted_at": "2022-07-05T04:00:34.03352Z",
68
+ "message_updated_at": "2023-02-14T03:54:19.342950Z",
69
  }
70
 
71
  Output
mathtext_fastapi/nlu.py CHANGED
@@ -64,6 +64,9 @@ def prepare_message_data_for_logging(message_data, nlu_response):
64
  }
65
  contact_data_log = get_or_create_supabase_entry('contact', contact_data)
66
 
 
 
 
67
  message_data = {
68
  'contact': contact_data_log.data[0]['id'], # FK
69
  'original_message_id': message_data['message_id'],
 
64
  }
65
  contact_data_log = get_or_create_supabase_entry('contact', contact_data)
66
 
67
+
68
+ del message_data['author_id']
69
+
70
  message_data = {
71
  'contact': contact_data_log.data[0]['id'], # FK
72
  'original_message_id': message_data['message_id'],