-
Notifications
You must be signed in to change notification settings - Fork 45k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Remove references to (broken) vector memory * Move workspace setup to `WorkspaceMixin.attach_fs` hook * Move directives into `BaseAgentSettings`
- Loading branch information
Showing
19 changed files
with
191 additions
and
168 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
autogpts/autogpt/autogpt/agents/utils/agent_file_manager.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
from __future__ import annotations | ||
|
||
import logging | ||
from pathlib import Path | ||
|
||
logger = logging.getLogger(__name__) | ||
|
||
|
||
class AgentFileManager: | ||
"""A class that represents a workspace for an AutoGPT agent.""" | ||
|
||
def __init__(self, agent_data_dir: Path): | ||
self._root = agent_data_dir.resolve() | ||
|
||
@property | ||
def root(self) -> Path: | ||
"""The root directory of the workspace.""" | ||
return self._root | ||
|
||
def initialize(self) -> None: | ||
self.root.mkdir(exist_ok=True, parents=True) | ||
self.init_file_ops_log(self.file_ops_log_path) | ||
|
||
@property | ||
def state_file_path(self) -> Path: | ||
return self.root / "state.json" | ||
|
||
@property | ||
def file_ops_log_path(self) -> Path: | ||
return self.root / "file_logger.log" | ||
|
||
@staticmethod | ||
def init_file_ops_log(file_logger_path: Path) -> Path: | ||
if not file_logger_path.exists(): | ||
with file_logger_path.open(mode="w", encoding="utf-8") as f: | ||
f.write("File Operation Logger ") | ||
return file_logger_path |
Oops, something went wrong.