Adding Allowlisted Plugins via env

pull/757/head
riensen 2023-04-19 12:48:51 +02:00
parent 4c7b582454
commit c5b81b5e10
3 changed files with 19 additions and 2 deletions

View File

@ -175,3 +175,10 @@ TW_CONSUMER_KEY=
TW_CONSUMER_SECRET= TW_CONSUMER_SECRET=
TW_ACCESS_TOKEN= TW_ACCESS_TOKEN=
TW_ACCESS_TOKEN_SECRET= TW_ACCESS_TOKEN_SECRET=
################################################################################
### ALLOWLISTED PLUGINS
################################################################################
#ALLOWLISTED_PLUGINS - Sets the listed plugins that are allowed (Example: plugin1,plugin2,plugin3)
ALLOWLISTED_PLUGINS=

View File

@ -264,7 +264,11 @@ Drop the repo's zipfile in the plugins folder.
![Download Zip](https://raw.githubusercontent.com/BillSchumacher/Auto-GPT/master/plugin.png) ![Download Zip](https://raw.githubusercontent.com/BillSchumacher/Auto-GPT/master/plugin.png)
If you add the plugins class name to the whitelist in the config.py you will not be prompted otherwise you'll be warned before loading the plugin. If you add the plugins class name to the `ALLOWLISTED_PLUGINS` in the `.env` you will not be prompted otherwise you'll be warned before loading the plugin:
```
ALLOWLISTED_PLUGINS=example-plugin1,example-plugin2,example-plugin3
```
## Setting Your Cache Type ## Setting Your Cache Type

View File

@ -116,7 +116,13 @@ class Config(metaclass=Singleton):
self.plugins_dir = os.getenv("PLUGINS_DIR", "plugins") self.plugins_dir = os.getenv("PLUGINS_DIR", "plugins")
self.plugins: List[AutoGPTPluginTemplate] = [] self.plugins: List[AutoGPTPluginTemplate] = []
self.plugins_openai = [] self.plugins_openai = []
self.plugins_whitelist = []
plugins_allowlist = os.getenv("ALLOWLISTED_PLUGINS")
if plugins_allowlist:
plugins_allowlist=plugins_allowlist.split(",")
self.plugins_whitelist = plugins_allowlist
else:
self.plugins_whitelist = []
self.plugins_blacklist = [] self.plugins_blacklist = []
def get_azure_deployment_id_for_model(self, model: str) -> str: def get_azure_deployment_id_for_model(self, model: str) -> str: