mirror of
https://github.com/aljazceru/Auto-GPT.git
synced 2026-01-31 20:04:28 +01:00
fix(agent): Fix type issues with agent ID and apply_overrides_to_ai_settings
- Fix type annotation for `agent_id` in `BaseAgentSettings` class - Add assertion to ensure `agent_id` is not an empty string in `AgentManager.get_agent_dir()` method - Change type of `override_name` and `override_role` to be optional in `apply_overrides_to_ai_settings()` function
This commit is contained in:
@@ -29,6 +29,7 @@ class AgentManager:
|
||||
]
|
||||
|
||||
def get_agent_dir(self, agent_id: str, must_exist: bool = False) -> Path:
|
||||
assert len(agent_id) > 0
|
||||
agent_dir = self.agents_dir / agent_id
|
||||
if must_exist and not agent_dir.exists():
|
||||
raise FileNotFoundError(f"No agent with ID '{agent_id}'")
|
||||
|
||||
@@ -124,7 +124,7 @@ class BaseAgentConfiguration(SystemConfiguration):
|
||||
|
||||
|
||||
class BaseAgentSettings(SystemSettings):
|
||||
agent_id: Optional[str] = None
|
||||
agent_id: str = ""
|
||||
agent_data_dir: Optional[Path] = None
|
||||
|
||||
ai_profile: AIProfile = Field(default_factory=lambda: AIProfile(ai_name="AutoGPT"))
|
||||
|
||||
@@ -12,8 +12,8 @@ logger = logging.getLogger(__name__)
|
||||
def apply_overrides_to_ai_settings(
|
||||
ai_profile: AIProfile,
|
||||
directives: AIDirectives,
|
||||
override_name: str = "",
|
||||
override_role: str = "",
|
||||
override_name: Optional[str] = "",
|
||||
override_role: Optional[str] = "",
|
||||
replace_directives: bool = False,
|
||||
resources: Optional[list[str]] = None,
|
||||
constraints: Optional[list[str]] = None,
|
||||
|
||||
Reference in New Issue
Block a user