camparchimedes commited on
Commit
2b9a3de
ยท
verified ยท
1 Parent(s): f0e43b6

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +20 -20
app.py CHANGED
@@ -175,8 +175,8 @@ async def handle_message(message: cl.Message):
175
  }
176
 
177
  response = await post_tool.arun(
178
- json.dumps(post_data),
179
- callbacks=[cl.AsyncLangchainCallbackHandler()]
180
  )
181
 
182
  # --degug!
@@ -187,27 +187,27 @@ async def handle_message(message: cl.Message):
187
  booking_data = json.loads(response)
188
  table = "| Field | Information |\n|---|---|\n"
189
 
190
- fields_mapping = [
191
- ('booking_id', 'Booking ID'),
192
- ('full_name', 'Full Name'),
193
- ('amount', 'Amount'),
194
- ('checkin', 'Check-in'),
195
- ('checkout', 'Check-out'),
196
- ('address', 'Address'),
197
- ('user_id', 'User ID'),
198
- ('infotext', 'Info Text'),
199
- ('included', 'Included')
200
- ]
201
 
202
- for field, display_name in fields_mapping:
203
- value = booking_data.get(field, 'N/A')
204
- table += f"| {display_name} | {value} |\n"
205
 
206
 
207
- await cl.Message(content=table).send()
208
-
209
- except Exception as e:
210
- error_msg = f"Error: Could not parse the booking information. Details: {str(e)}"
211
  await cl.Message(error_msg).send()
212
 
213
  else:
 
175
  }
176
 
177
  response = await post_tool.arun(
178
+ post_data,
179
+ config={"callbacks": [cl.AsyncLangchainCallbackHandler()]}
180
  )
181
 
182
  # --degug!
 
187
  booking_data = json.loads(response)
188
  table = "| Field | Information |\n|---|---|\n"
189
 
190
+ fields_mapping = [
191
+ ('booking_id', 'Booking ID'),
192
+ ('full_name', 'Full Name'),
193
+ ('amount', 'Amount'),
194
+ ('checkin', 'Check-in'),
195
+ ('checkout', 'Check-out'),
196
+ ('address', 'Address'),
197
+ ('user_id', 'User ID'),
198
+ ('infotext', 'Info Text'),
199
+ ('included', 'Included')
200
+ ]
201
 
202
+ for field, display_name in fields_mapping:
203
+ value = booking_data.get(field, 'N/A')
204
+ table += f"| {display_name} | {value} |\n"
205
 
206
 
207
+ await cl.Message(content=table).send()
208
+
209
+ except Exception as e:
210
+ error_msg = f"Error: Could not parse the booking information. Details: {str(e)}"
211
  await cl.Message(error_msg).send()
212
 
213
  else: