camparchimedes commited on
Commit
ef5280a
·
verified ·
1 Parent(s): 88ddd07

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -9
app.py CHANGED
@@ -132,8 +132,7 @@ def setup_multiple_chains():
132
  "Content-Type": "application/json"
133
  }
134
  )
135
-
136
-
137
  post_tool = RequestsPostTool(
138
  requests_wrapper=requests_wrapper,
139
  allow_dangerous_requests=True
@@ -149,25 +148,23 @@ async def handle_message(message: cl.Message):
149
  api_chain = cl.user_session.get("api_chain")
150
  post_tool = cl.user_session.get("post_tool")
151
 
 
152
  booking_pattern = r'\b[A-Z]{6}\d{6}\b'
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
-
160
  post_data = {
161
- "url": endpoint_url,
162
  "body": {
163
  "booking_id": bestillingskode
164
  }
165
  }
166
-
167
-
168
-
169
  response = await post_tool.ainvoke(
170
- post_data,
171
  config={"callbacks": [cl.AsyncLangchainCallbackHandler()]}
172
 
173
  )
 
132
  "Content-Type": "application/json"
133
  }
134
  )
135
+
 
136
  post_tool = RequestsPostTool(
137
  requests_wrapper=requests_wrapper,
138
  allow_dangerous_requests=True
 
148
  api_chain = cl.user_session.get("api_chain")
149
  post_tool = cl.user_session.get("post_tool")
150
 
151
+ api_url = "https://aivisions.no/data/daysoff/api/v1/booking/"
152
  booking_pattern = r'\b[A-Z]{6}\d{6}\b'
153
  match = re.search(booking_pattern, user_message)
154
 
155
 
156
  if match:
157
  bestillingskode = match.group()
158
+
 
159
  post_data = {
160
+ "api_url": api_url,
161
  "body": {
162
  "booking_id": bestillingskode
163
  }
164
  }
165
+
 
 
166
  response = await post_tool.ainvoke(
167
+ json.dumps(post_data),
168
  config={"callbacks": [cl.AsyncLangchainCallbackHandler()]}
169
 
170
  )