mirror of
https://github.com/Significant-Gravitas/AutoGPT.git
synced 2026-01-08 22:58:01 -05:00
Only take subclasses of AutoGPTPluginTemplate as plugins
Co-authored-by: Nicholas Tindle <nick@ntindle.com> Co-authored-by: Luke <2609441+lc0rp@users.noreply.github.com>
This commit is contained in:
2
.gitignore
vendored
2
.gitignore
vendored
@@ -31,7 +31,7 @@ __pycache__/
|
|||||||
build/
|
build/
|
||||||
develop-eggs/
|
develop-eggs/
|
||||||
dist/
|
dist/
|
||||||
plugins/
|
/plugins/
|
||||||
plugins_config.yaml
|
plugins_config.yaml
|
||||||
downloads/
|
downloads/
|
||||||
eggs/
|
eggs/
|
||||||
|
|||||||
@@ -259,9 +259,10 @@ def scan_plugins(config: Config, debug: bool = False) -> List[AutoGPTPluginTempl
|
|||||||
if key.startswith("__"):
|
if key.startswith("__"):
|
||||||
continue
|
continue
|
||||||
a_module = getattr(zipped_module, key)
|
a_module = getattr(zipped_module, key)
|
||||||
a_keys = dir(a_module)
|
|
||||||
if (
|
if (
|
||||||
"_abc_impl" in a_keys
|
inspect.isclass(a_module)
|
||||||
|
and issubclass(a_module, AutoGPTPluginTemplate)
|
||||||
and a_module.__name__ != "AutoGPTPluginTemplate"
|
and a_module.__name__ != "AutoGPTPluginTemplate"
|
||||||
):
|
):
|
||||||
plugin_name = a_module.__name__
|
plugin_name = a_module.__name__
|
||||||
@@ -284,6 +285,10 @@ def scan_plugins(config: Config, debug: bool = False) -> List[AutoGPTPluginTempl
|
|||||||
f"they are enabled in plugins_config.yaml. Zipped plugins should use the class "
|
f"they are enabled in plugins_config.yaml. Zipped plugins should use the class "
|
||||||
f"name ({plugin_name}) as the key."
|
f"name ({plugin_name}) as the key."
|
||||||
)
|
)
|
||||||
|
else:
|
||||||
|
logger.debug(
|
||||||
|
f"Skipping {key}: {a_module.__name__} because it doesn't subclass AutoGPTPluginTemplate."
|
||||||
|
)
|
||||||
|
|
||||||
# OpenAI plugins
|
# OpenAI plugins
|
||||||
if config.plugins_openai:
|
if config.plugins_openai:
|
||||||
|
|||||||
Reference in New Issue
Block a user