camparchimedes commited on
Commit
46ed965
·
verified ·
1 Parent(s): b8ca354

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +27 -1
app.py CHANGED
@@ -116,9 +116,11 @@ async def handle_message(message: cl.Message):
116
  booking_pattern = r'\b[A-Z]{6}\d{6}\b'
117
  endpoint_url = "https://aivisions.no/data/daysoff/api/v1/booking/"
118
 
 
 
119
  if re.search(booking_pattern, user_message):
120
  bestillingskode = re.search(booking_pattern, user_message).group(0)
121
- question = f"Retrieve information for booking ID {endpoint_url}?search={bestillingskode}" # @POST:
122
 
123
  response = await api_chain.acall(
124
  {
@@ -139,3 +141,27 @@ async def handle_message(message: cl.Message):
139
 
140
  #endpoint_url = "https://670dccd0073307b4ee447f2f.mockapi.io/daysoff/api/V1/booking"
141
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
116
  booking_pattern = r'\b[A-Z]{6}\d{6}\b'
117
  endpoint_url = "https://aivisions.no/data/daysoff/api/v1/booking/"
118
 
119
+
120
+ # --GET method
121
  if re.search(booking_pattern, user_message):
122
  bestillingskode = re.search(booking_pattern, user_message).group(0)
123
+ question = f"Retrieve information for booking ID {endpoint_url}?search={bestillingskode}"
124
 
125
  response = await api_chain.acall(
126
  {
 
141
 
142
  #endpoint_url = "https://670dccd0073307b4ee447f2f.mockapi.io/daysoff/api/V1/booking"
143
 
144
+
145
+ """
146
+ # --POST method, booking_id@body
147
+ if re.search(booking_pattern, user_message):
148
+ bestillingskode = re.search(booking_pattern, user_message).group(0)
149
+ question = f"Retrieve information for booking ID {bestillingskode}"
150
+
151
+ response = await api_chain.acall(
152
+ {
153
+ "url": endpoint_url,
154
+ "method": "POST",
155
+ "headers": {
156
+ "Authorization": f"Bearer {auth_token}",
157
+ "Content-Type": "application/json"
158
+ },
159
+ "body": {
160
+ "booking_id": bestillingskode
161
+ },
162
+ "question": question
163
+ },
164
+ callbacks=[cl.AsyncLangchainCallbackHandler()]
165
+ )
166
+
167
+ """