Remove config from command decorator (#4736)

This commit is contained in:
merwanehamadi
2023-06-18 20:00:23 -07:00
committed by GitHub
parent 8077d2a249
commit 0abfa3a68f

View File

@@ -2,7 +2,6 @@ import functools
from typing import Any, Callable, Dict, Optional
from autogpt.config import Config
from autogpt.logs import logger
from autogpt.models.command import Command
# Unique identifier for auto-gpt commands
@@ -18,16 +17,6 @@ def command(
) -> Callable[..., Any]:
"""The command decorator is used to create Command objects from ordinary functions."""
# TODO: Remove this in favor of better command management
config = Config()
if callable(enabled):
enabled = enabled(config)
if not enabled:
if disabled_reason is not None:
logger.debug(f"Command '{name}' is disabled: {disabled_reason}")
return lambda func: func
def decorator(func: Callable[..., Any]) -> Command:
cmd = Command(
name=name,