camparchimedes commited on
Commit
c666f06
ยท
verified ยท
1 Parent(s): 03cadc5

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +15 -19
app.py CHANGED
@@ -184,26 +184,22 @@ async def handle_message(message: cl.Message):
184
 
185
  if response:
186
  try:
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:
 
184
 
185
  if response:
186
  try:
187
+ booking_data = json.loads(response.get("output", "{}"))
188
  table = "| Field | Information |\n|---|---|\n"
189
+
190
+ table = f"""
191
+ | Field | Value |
192
+ |-------------|--------------------|
193
+ | Booking ID | {booking_data.get('booking_id', 'N/A')} |
194
+ | Name | {booking_data.get('full_name', 'N/A')} |
195
+ | Amount | {booking_data.get('amount', 'N/A')} kr |
196
+ | Check-in | {booking_data.get('checkin', 'N/A')} |
197
+ | Check-out | {booking_data.get('checkout', 'N/A')} |
198
+ | Address | {booking_data.get('address', 'N/A')} |
199
+ | User ID | {booking_data.get('user_id', 'N/A')} |
200
+ | Info | {booking_data.get('infotext', 'N/A')} |
201
+ | Included | {booking_data.get('included', 'N/A')} |
202
+ """
 
 
 
 
203
  await cl.Message(content=table).send()
204
 
205
  except Exception as e: