AutoGPT is the vision of accessible AI for everyone, to use and to build on. Our mission is to provide the tools, so that you can focus on what matters.
change to stream respsonse (#5285)
Swifty12f3a321b71c
diff --git a/autogpts/forge/forge/sdk/agent.py b/autogpts/forge/forge/sdk/agent.pyindex 9537865a61..59ba2c98e1 100644--- a/autogpts/forge/forge/sdk/agent.py+++ b/autogpts/forge/forge/sdk/agent.py@@ -2,6 +2,8 @@ import asyncioimport osimport pathlibfrom uuid import uuid4+from fastapi.responses import StreamingResponse+from io import BytesIOfrom fastapi import APIRouter, FastAPI, UploadFilefrom fastapi.middleware.cors import CORSMiddleware@@ -196,17 +198,11 @@ class Agent:artifact = await self.db.get_artifact(artifact_id)file_path = os.path.join(artifact.relative_path, artifact.file_name)retrieved_artifact = self.workspace.read(task_id=task_id, path=file_path)- path = artifact.file_name- with open(path, "wb") as f:- f.write(retrieved_artifact)except NotFoundError as e:raiseexcept FileNotFoundError as e:raiseexcept Exception as e:raise- return FileResponse(- # Note: mimetype is guessed in the FileResponse constructor- path=path,- filename=artifact.file_name,- )++ return StreamingResponse(BytesIO(retrieved_artifact), media_type='application/octet-stream', headers={'Content-Disposition': f'attachment; filename={artifact.file_name}'})diff --git a/autogpts/forge/forge/sdk/forge_log.py b/autogpts/forge/forge/sdk/forge_log.pyindex f27f9df2c3..ea607a2880 100644--- a/autogpts/forge/forge/sdk/forge_log.py+++ b/autogpts/forge/forge/sdk/forge_log.py@@ -179,17 +179,17 @@ logging_config: dict = dict("h": {"class": "logging.StreamHandler","formatter": "console",- "level": logging.DEBUG,+ "level": logging.INFO,},},root={"handlers": ["h"],- "level": logging.DEBUG,+ "level": logging.INFO,},loggers={"autogpt": {"handlers": ["h"],- "level": logging.DEBUG,+ "level": logging.INFO,"propagate": False,},},