Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -164,18 +164,22 @@ async def handle_message(message: cl.Message):
|
|
164 |
try:
|
165 |
if re.search(booking_pattern, user_message):
|
166 |
booking_id = re.search(booking_pattern, user_message).group(0)
|
167 |
-
|
168 |
|
169 |
url = f"{base_url}?search={booking_id}"
|
170 |
-
logging.debug(f"Constructed API URL: {url}")
|
171 |
|
172 |
-
response = await api_chain.acall(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
173 |
else:
|
174 |
-
logging.debug("Triggered LLMChain for <booking-related>")
|
175 |
response = await llm_chain.acall(user_message, callbacks=[cl.AsyncLangchainCallbackHandler()])
|
176 |
|
177 |
except Exception as e:
|
178 |
-
logging.error(f"Error in processing message: {str(e)}")
|
179 |
response = {"output": "Jeg fรฅr desverre ikke fram din informasjon akkurat nรฅ."}
|
180 |
|
181 |
response_key = "output" if "output" in response else "text"
|
|
|
164 |
try:
|
165 |
if re.search(booking_pattern, user_message):
|
166 |
booking_id = re.search(booking_pattern, user_message).group(0)
|
167 |
+
question = f"Retrieve information for booking ID {booking_id}"
|
168 |
|
169 |
url = f"{base_url}?search={booking_id}"
|
|
|
170 |
|
171 |
+
response = await api_chain.acall(
|
172 |
+
{
|
173 |
+
"booking_id": booking_id,
|
174 |
+
"question": question
|
175 |
+
},
|
176 |
+
callbacks=[cl.AsyncLangchainCallbackHandler()]
|
177 |
+
|
178 |
+
#response = await api_chain.acall({"booking_id": booking_id}, callbacks=[cl.AsyncLangchainCallbackHandler()])
|
179 |
else:
|
|
|
180 |
response = await llm_chain.acall(user_message, callbacks=[cl.AsyncLangchainCallbackHandler()])
|
181 |
|
182 |
except Exception as e:
|
|
|
183 |
response = {"output": "Jeg fรฅr desverre ikke fram din informasjon akkurat nรฅ."}
|
184 |
|
185 |
response_key = "output" if "output" in response else "text"
|