mirror of
https://github.com/aljazceru/Auto-GPT.git
synced 2025-12-18 14:34:23 +01:00
refactor: Remove unused debug argument from plugin setup helpers
- Remove the unused debug argument from the functions `inspect_zip_for_modules`, `initialize_openai_plugins`, `instantiate_openai_plugin_clients`, and `scan_plugins`. - The debug argument was not being used in these functions and was unnecessary.
This commit is contained in:
@@ -61,7 +61,7 @@ def _configure_agent(
|
||||
"Either (state) or (task, ai_profile, directives) must be specified"
|
||||
)
|
||||
|
||||
app_config.plugins = scan_plugins(app_config, app_config.debug_mode)
|
||||
app_config.plugins = scan_plugins(app_config)
|
||||
configure_chat_plugins(app_config)
|
||||
|
||||
# Create a CommandRegistry instance and scan default folder
|
||||
|
||||
@@ -125,7 +125,7 @@ async def run_auto_gpt(
|
||||
if install_plugin_deps:
|
||||
install_plugin_dependencies()
|
||||
|
||||
config.plugins = scan_plugins(config, config.debug_mode)
|
||||
config.plugins = scan_plugins(config)
|
||||
configure_chat_plugins(config)
|
||||
|
||||
# Let user choose an existing agent to run
|
||||
@@ -333,7 +333,7 @@ async def run_auto_gpt_server(
|
||||
if install_plugin_deps:
|
||||
install_plugin_dependencies()
|
||||
|
||||
config.plugins = scan_plugins(config, config.debug_mode)
|
||||
config.plugins = scan_plugins(config)
|
||||
|
||||
# Set up & start server
|
||||
database = AgentDB("sqlite:///data/ap_server.db", debug_enabled=False)
|
||||
|
||||
@@ -26,7 +26,7 @@ from autogpt.models.base_open_ai_plugin import BaseOpenAIPlugin
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
def inspect_zip_for_modules(zip_path: str, debug: bool = False) -> list[str]:
|
||||
def inspect_zip_for_modules(zip_path: str) -> list[str]:
|
||||
"""
|
||||
Inspect a zipfile for a modules.
|
||||
|
||||
@@ -134,9 +134,7 @@ def create_directory_if_not_exists(directory_path: str) -> bool:
|
||||
return True
|
||||
|
||||
|
||||
def initialize_openai_plugins(
|
||||
manifests_specs: dict, config: Config, debug: bool = False
|
||||
) -> dict:
|
||||
def initialize_openai_plugins(manifests_specs: dict, config: Config) -> dict:
|
||||
"""
|
||||
Initialize OpenAI plugins.
|
||||
Args:
|
||||
@@ -188,9 +186,7 @@ def initialize_openai_plugins(
|
||||
return manifests_specs
|
||||
|
||||
|
||||
def instantiate_openai_plugin_clients(
|
||||
manifests_specs_clients: dict, config: Config, debug: bool = False
|
||||
) -> dict:
|
||||
def instantiate_openai_plugin_clients(manifests_specs_clients: dict) -> dict:
|
||||
"""
|
||||
Instantiates BaseOpenAIPlugin instances for each OpenAI plugin.
|
||||
Args:
|
||||
@@ -207,7 +203,7 @@ def instantiate_openai_plugin_clients(
|
||||
return plugins
|
||||
|
||||
|
||||
def scan_plugins(config: Config, debug: bool = False) -> List[AutoGPTPluginTemplate]:
|
||||
def scan_plugins(config: Config) -> List[AutoGPTPluginTemplate]:
|
||||
"""Scan the plugins directory for plugins and loads them.
|
||||
|
||||
Args:
|
||||
@@ -254,7 +250,7 @@ def scan_plugins(config: Config, debug: bool = False) -> List[AutoGPTPluginTempl
|
||||
|
||||
# Zip-based plugins
|
||||
for plugin in plugins_path.glob("*.zip"):
|
||||
if moduleList := inspect_zip_for_modules(str(plugin), debug):
|
||||
if moduleList := inspect_zip_for_modules(str(plugin)):
|
||||
for module in moduleList:
|
||||
plugin = Path(plugin)
|
||||
module = Path(module)
|
||||
@@ -307,9 +303,7 @@ def scan_plugins(config: Config, debug: bool = False) -> List[AutoGPTPluginTempl
|
||||
if config.plugins_openai:
|
||||
manifests_specs = fetch_openai_plugins_manifest_and_spec(config)
|
||||
if manifests_specs.keys():
|
||||
manifests_specs_clients = initialize_openai_plugins(
|
||||
manifests_specs, config, debug
|
||||
)
|
||||
manifests_specs_clients = initialize_openai_plugins(manifests_specs, config)
|
||||
for url, openai_plugin_meta in manifests_specs_clients.items():
|
||||
if not plugins_config.is_enabled(url):
|
||||
logger.warn(
|
||||
|
||||
@@ -21,7 +21,7 @@ def test_scan_plugins_openai(config: Config):
|
||||
)
|
||||
|
||||
# Test that the function returns the correct number of plugins
|
||||
result = scan_plugins(config, debug=True)
|
||||
result = scan_plugins(config)
|
||||
assert len(result) == 1
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@ def test_scan_plugins_generic(config: Config):
|
||||
plugins_config.plugins["AutoGPTPVicuna"] = PluginConfig(
|
||||
name="AutoGPTPVicuna", enabled=True
|
||||
)
|
||||
result = scan_plugins(config, debug=True)
|
||||
result = scan_plugins(config)
|
||||
plugin_class_names = [plugin.__class__.__name__ for plugin in result]
|
||||
|
||||
assert len(result) == 2
|
||||
@@ -51,7 +51,7 @@ def test_scan_plugins_not_enabled(config: Config):
|
||||
plugins_config.plugins["auto_gpt_vicuna"] = PluginConfig(
|
||||
name="auto_gptp_vicuna", enabled=False
|
||||
)
|
||||
result = scan_plugins(config, debug=True)
|
||||
result = scan_plugins(config)
|
||||
plugin_class_names = [plugin.__class__.__name__ for plugin in result]
|
||||
|
||||
assert len(result) == 1
|
||||
|
||||
Reference in New Issue
Block a user