tommy24 commited on
Commit
0a31dcc
·
1 Parent(s): 81eecd5

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +45 -0
app.py CHANGED
@@ -1029,6 +1029,25 @@ def classify(platform, UserInput, Images, Textbox2, Textbox3):
1029
  )
1030
 
1031
  return "Chat History cleared successfuly!"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1032
 
1033
  # def get_current_weather(location: str, unit: str):
1034
  # """
@@ -1134,6 +1153,25 @@ def classify(platform, UserInput, Images, Textbox2, Textbox3):
1134
  "required": ["command"],
1135
  },
1136
  },
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1137
  ]
1138
 
1139
  # functions = [
@@ -1209,6 +1247,11 @@ def classify(platform, UserInput, Images, Textbox2, Textbox3):
1209
  )
1210
  reply = [{"Mode": "Chat", "content": function_response}]
1211
  return reply
 
 
 
 
 
1212
  elif function_name == "book_enquiry":
1213
  function_response = book_enquiry(
1214
  full_name=arguments_dict["full_name"],
@@ -1224,6 +1267,8 @@ def classify(platform, UserInput, Images, Textbox2, Textbox3):
1224
  # print("ARGUMENTS VALUES:", arguments_dict["location"], arguments_dict["unit"])
1225
  if function_name == "clear_chat_history":
1226
  print(f"ARGUMENTS VALUES: Command: {arguments_dict['command']}")
 
 
1227
  elif function_name == "book_enquiry":
1228
  print(f"ARGUMENTS VALUES: Full_name: {arguments_dict['full_name']}, Contact Number: {arguments_dict['contact_number']}, Street Address: {arguments_dict['street_address']}, Landmark: {arguments_dict['landmark']}, Zip Code: {arguments_dict['zip_code']}, Emirate: {arguments_dict['emirate']}, Reason: {arguments_dict['reason']}")
1229
 
 
1029
  )
1030
 
1031
  return "Chat History cleared successfuly!"
1032
+
1033
+
1034
+ def show_my_points(name: str, email: str):
1035
+ """
1036
+ This function allow the user to view their total points they got by Waste Diposal
1037
+ @param name: This should the registered name of the user
1038
+ @param email: This should be the registered email of the user
1039
+ """
1040
+ points = requests.post("https://sustainai.tech/user/points", json={
1041
+ "name": name,
1042
+ "email": email
1043
+ })
1044
+
1045
+ if points.status_code == 200:
1046
+ point_data = points.json()
1047
+ userPoints = point_data[""]
1048
+ return f"User: {name}'s Total points is: {userPoints}'"
1049
+ else:
1050
+ return "The request has been declined. Please ensure that the provided details match the records registered in our system during the registration process"
1051
 
1052
  # def get_current_weather(location: str, unit: str):
1053
  # """
 
1153
  "required": ["command"],
1154
  },
1155
  },
1156
+
1157
+ {
1158
+ "name": "show_my_points",
1159
+ "description": "This function allow the user to view their total points they got by Waste Diposal",
1160
+ "parameters": {
1161
+ "type": "object",
1162
+ "properties": {
1163
+ "name": {
1164
+ "type": "string",
1165
+ "description": "This should the registered name of the user",
1166
+ },
1167
+ "email": {
1168
+ "type": "string",
1169
+ "description": "This should be the registered email of the user",
1170
+ },
1171
+ },
1172
+ "required": ["name", "email"],
1173
+ },
1174
+ },
1175
  ]
1176
 
1177
  # functions = [
 
1247
  )
1248
  reply = [{"Mode": "Chat", "content": function_response}]
1249
  return reply
1250
+ elif function_name == "show_my_points":
1251
+ function_response = show_my_points(
1252
+ name=arguments_dict["name"],
1253
+ email=arguments_dict["email"],
1254
+ )
1255
  elif function_name == "book_enquiry":
1256
  function_response = book_enquiry(
1257
  full_name=arguments_dict["full_name"],
 
1267
  # print("ARGUMENTS VALUES:", arguments_dict["location"], arguments_dict["unit"])
1268
  if function_name == "clear_chat_history":
1269
  print(f"ARGUMENTS VALUES: Command: {arguments_dict['command']}")
1270
+ elif function_name == "show_my_points":
1271
+ print(f"ARGUMENTS VALUES: Name: {arguments_dict['name']}, Email: {arguments_dict['email']}")
1272
  elif function_name == "book_enquiry":
1273
  print(f"ARGUMENTS VALUES: Full_name: {arguments_dict['full_name']}, Contact Number: {arguments_dict['contact_number']}, Street Address: {arguments_dict['street_address']}, Landmark: {arguments_dict['landmark']}, Zip Code: {arguments_dict['zip_code']}, Emirate: {arguments_dict['emirate']}, Reason: {arguments_dict['reason']}")
1274