Skip to content

🌟 The Multi-Agent Framework: First AI Software Company, Towards Natural Language Programming

feat: save + return

莘权 马662102d18822
diff --git a/metagpt/utils/file_repository.py b/metagpt/utils/file_repository.py
index 01b78cd77..1cb347a19 100644
--- a/metagpt/utils/file_repository.py
+++ b/metagpt/utils/file_repository.py
@@ -45,7 +45,7 @@ class FileRepository:
# Initializing
self.workdir.mkdir(parents=True, exist_ok=True)
- async def save(self, filename: Path | str, content, dependencies: List[str] = None):
+ async def save(self, filename: Path | str, content, dependencies: List[str] = None) -> Document:
"""Save content to a file and update its dependencies.
:param filename: The filename or path within the repository.
@@ -63,6 +63,8 @@ class FileRepository:
await dependency_file.update(pathname, set(dependencies))
logger.info(f"update dependency: {str(pathname)}:{dependencies}")
+ return Document(root_path=str(self._relative_path), filename=filename, content=content)
+
async def get_dependency(self, filename: Path | str) -> Set[str]:
"""Get the dependencies of a file.