kuzumab commited on
Commit
a029f06
·
verified ·
1 Parent(s): 3d98dd6

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -7
app.py CHANGED
@@ -18,7 +18,7 @@ class AttachmentDownloadTool(Tool):
18
  "description": "task_id that needs to download attachment files."
19
  }
20
  }
21
- output_type = io.BytesIO
22
 
23
  def forward(self, task_id):
24
  download_url = f"{api_url}/files/"
@@ -26,12 +26,10 @@ class AttachmentDownloadTool(Tool):
26
  try:
27
  response = requests.get(download_url + task_id, stream=True, timeout=15)
28
  if response.status_code != 200:
29
- return io.BytesIO()
30
- file_obj = io.BytesIO(response.content)
31
- file_obj.seek(0)
32
- return file_obj
33
  except Exception as e:
34
- return io.BytesIO()
35
 
36
  class ImageCaptionTool(Tool):
37
  name = "image-captioner"
@@ -129,7 +127,7 @@ class BasicAgent:
129
  self.agent = CodeAgent(
130
  tools=self.tools,
131
  model=self.think_model,
132
- managed_agents=[web_agent,],
133
  additional_authorized_imports=["time", "numpy", "pandas"],
134
  max_steps=20
135
  )
 
18
  "description": "task_id that needs to download attachment files."
19
  }
20
  }
21
+ output_type = bytes
22
 
23
  def forward(self, task_id):
24
  download_url = f"{api_url}/files/"
 
26
  try:
27
  response = requests.get(download_url + task_id, stream=True, timeout=15)
28
  if response.status_code != 200:
29
+ return None
30
+ return response.content
 
 
31
  except Exception as e:
32
+ return None
33
 
34
  class ImageCaptionTool(Tool):
35
  name = "image-captioner"
 
127
  self.agent = CodeAgent(
128
  tools=self.tools,
129
  model=self.think_model,
130
+ managed_agents=[web_agent],
131
  additional_authorized_imports=["time", "numpy", "pandas"],
132
  max_steps=20
133
  )