Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
@@ -133,38 +133,35 @@ async def handle_message(message: cl.Message):
|
|
133 |
try:
|
134 |
|
135 |
if match:
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
else:
|
167 |
-
await cl.Message("Jeg kan desverre ikke finne noen informasjon for det oppgitte bookingnummeret.").send()
|
168 |
|
169 |
else:
|
170 |
response = await llm_chain.acall(user_message, callbacks=[cl.AsyncLangchainCallbackHandler()])
|
|
|
133 |
try:
|
134 |
|
135 |
if match:
|
136 |
+
bestillingskode = match.group()
|
137 |
+
question = f"Retrieve information for booking ID {base_url}?search={bestillingskode}"
|
138 |
+
|
139 |
+
response = await api_chain.acall(
|
140 |
+
{
|
141 |
+
"bestillingskode": bestillingskode,
|
142 |
+
"question": question
|
143 |
+
|
144 |
+
},
|
145 |
+
callbacks=[cl.AsyncLangchainCallbackHandler()])
|
146 |
+
|
147 |
+
booking_info = json.loads(response.get("output", "{}"))
|
148 |
+
|
149 |
+
formatted_response = f"""
|
150 |
+
Her er informasjon for bestillingskode: {bestillingskode}
|
151 |
+
|
152 |
+
| Felt | Detaljer |
|
153 |
+
|-------------|----------------------------------------|
|
154 |
+
| Navn: | {booking_info.get('Navn', 'N/A')} |
|
155 |
+
| Belรธp: | {booking_info.get('Belรธp', 'N/A')} NOK |
|
156 |
+
| Check-In: | {booking_info.get('Checkin', 'N/A')} |
|
157 |
+
| Check-Out: | {booking_info.get('Checkout', 'N/A')} |
|
158 |
+
| Addresse: | {booking_info.get('Addresse', 'N/A')} |
|
159 |
+
| Bruker ID: | {booking_info.get('Bruker ID', 'N/A')} |
|
160 |
+
| Viktig informasjon: | {booking_info.get('Viktig informasjon', 'N/A')} |
|
161 |
+
| Message: | {booking_info.get('Message', 'N/A')} |
|
162 |
+
"""
|
163 |
+
|
164 |
+
await cl.Message(content=formatted_response).send()
|
|
|
|
|
|
|
165 |
|
166 |
else:
|
167 |
response = await llm_chain.acall(user_message, callbacks=[cl.AsyncLangchainCallbackHandler()])
|