mirror of
https://github.com/FoundationAgents/MetaGPT.git
synced 2026-05-21 14:05:17 +02:00
feat: save + return
This commit is contained in:
parent
2bac5535f7
commit
662102d188
1 changed files with 3 additions and 1 deletions
|
|
@ -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.
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue