aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--autogpts/autogpt/autogpt/command_decorator.py2
-rw-r--r--autogpts/autogpt/autogpt/models/command.py4
2 files changed, 3 insertions, 3 deletions
diff --git a/autogpts/autogpt/autogpt/command_decorator.py b/autogpts/autogpt/autogpt/command_decorator.py
index 70a519a42..f53c1ad85 100644
--- a/autogpts/autogpt/autogpt/command_decorator.py
+++ b/autogpts/autogpt/autogpt/command_decorator.py
@@ -25,7 +25,7 @@ def command(
enabled: Literal[True] | Callable[[Config], bool] = True,
disabled_reason: Optional[str] = None,
aliases: list[str] = [],
- available: Literal[True] | Callable[[BaseAgent], bool] = True,
+ available: bool | Callable[[BaseAgent], bool] = True,
) -> Callable[[Callable[P, CO]], Callable[P, CO]]:
"""
The command decorator is used to create Command objects from ordinary functions.
diff --git a/autogpts/autogpt/autogpt/models/command.py b/autogpts/autogpt/autogpt/models/command.py
index 90aa266cc..5472dc4aa 100644
--- a/autogpts/autogpt/autogpt/models/command.py
+++ b/autogpts/autogpt/autogpt/models/command.py
@@ -32,7 +32,7 @@ class Command:
enabled: Literal[True] | Callable[[Config], bool] = True,
disabled_reason: Optional[str] = None,
aliases: list[str] = [],
- available: Literal[True] | Callable[[BaseAgent], bool] = True,
+ available: bool | Callable[[BaseAgent], bool] = True,
):
self.name = name
self.description = description
@@ -55,7 +55,7 @@ class Command:
)
raise RuntimeError(f"Command '{self.name}' is disabled")
- if callable(self.available) and not self.available(agent):
+ if not self.available or callable(self.available) and not self.available(agent):
raise RuntimeError(f"Command '{self.name}' is not available")
return self.method(*args, **kwargs, agent=agent)