Skip to content

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.

Check if filename is already in relative path

SwiftyOSece0f9189fcf
diff --git a/autogpts/forge/forge/sdk/agent.py b/autogpts/forge/forge/sdk/agent.py
index a508e26d53..22476f5ea0 100644
--- a/autogpts/forge/forge/sdk/agent.py
+++ b/autogpts/forge/forge/sdk/agent.py
@@ -199,7 +199,10 @@ class Agent:
"""
try:
artifact = await self.db.get_artifact(artifact_id)
- file_path = os.path.join(artifact.relative_path, artifact.file_name)
+ if artifact.file_name not in artifact.relative_path:
+ file_path = os.path.join(artifact.relative_path, artifact.file_name)
+ else:
+ file_path = artifact.relative_path
retrieved_artifact = self.workspace.read(task_id=task_id, path=file_path)
except NotFoundError as e:
raise