Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -175,8 +175,8 @@ async def handle_message(message: cl.Message):
|
|
175 |
}
|
176 |
|
177 |
response = await post_tool.arun(
|
178 |
-
|
179 |
-
callbacks
|
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 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
|
206 |
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
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:
|