Update app.py
Browse files
app.py
CHANGED
@@ -153,7 +153,8 @@ async def handle_message(message: cl.Message):
|
|
153 |
match = re.search(booking_pattern, user_message)
|
154 |
|
155 |
|
156 |
-
if match:
|
|
|
157 |
bestillingskode = match.group()
|
158 |
endpoint_url = "https://aivisions.no/data/daysoff/api/v1/booking/"
|
159 |
|
@@ -171,12 +172,12 @@ if match:
|
|
171 |
|
172 |
if response:
|
173 |
await cl.Message(content=str(response)).send()
|
174 |
-
|
175 |
else:
|
176 |
response = await llm_chain.ainvoke(user_message, callbacks=[cl.AsyncLangchainCallbackHandler()])
|
177 |
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
|
182 |
|
|
|
153 |
match = re.search(booking_pattern, user_message)
|
154 |
|
155 |
|
156 |
+
if match:
|
157 |
+
|
158 |
bestillingskode = match.group()
|
159 |
endpoint_url = "https://aivisions.no/data/daysoff/api/v1/booking/"
|
160 |
|
|
|
172 |
|
173 |
if response:
|
174 |
await cl.Message(content=str(response)).send()
|
175 |
+
|
176 |
else:
|
177 |
response = await llm_chain.ainvoke(user_message, callbacks=[cl.AsyncLangchainCallbackHandler()])
|
178 |
|
179 |
+
response_key = "output" if "output" in response else "text"
|
180 |
+
await cl.Message(response.get(response_key, "")).send()
|
181 |
+
return message.content
|
182 |
|
183 |
|