diff --git a/.env.template b/.env.template index 68392d76..855cb91f 100644 --- a/.env.template +++ b/.env.template @@ -9,9 +9,6 @@ BROWSE_CHUNK_MAX_LENGTH=8192 # USER_AGENT="Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.97 Safari/537.36" # AI_SETTINGS_FILE - Specifies which AI Settings file to use (defaults to ai_settings.yaml) AI_SETTINGS_FILE=ai_settings.yaml -# USE_WEB_BROWSER - Sets the web-browser drivers to use with selenium (defaults to chrome). -# Note: set this to either 'chrome', 'firefox', or 'safari' depending on your current browser -# USE_WEB_BROWSER=chrome ################################################################################ ### LLM PROVIDER @@ -138,8 +135,11 @@ GITHUB_USERNAME=your-github-username ################################################################################ ### BROWSER -# HEADLESS_BROWSER - Whether to run the browser in headless mode -HEADLESS_BROWSER=True +# USE_WEB_BROWSER - Sets the web-browser drivers to use with selenium (defaults to chrome). +# HEADLESS_BROWSER - Whether to run the browser in headless mode (defaults to True) +# Note: set this to either 'chrome', 'firefox', or 'safari' depending on your current browser +# USE_WEB_BROWSER=chrome +# HEADLESS_BROWSER=True ### GOOGLE # GOOGLE_API_KEY - Google API key (Example: my-google-api-key) diff --git a/autogpt/commands/web_selenium.py b/autogpt/commands/web_selenium.py index 27706403..11bdfeb1 100644 --- a/autogpt/commands/web_selenium.py +++ b/autogpt/commands/web_selenium.py @@ -83,7 +83,7 @@ def scrape_text_with_selenium(url: str) -> tuple[WebDriver, str]: options.add_argument("--remote-debugging-port=9222") options.add_argument("--no-sandbox") - if CFG.headless_browser: + if CFG.selenium_headless: options.add_argument("--headless") options.add_argument("--disable-gpu") diff --git a/autogpt/config/config.py b/autogpt/config/config.py index 7e82627d..acf41c44 100644 --- a/autogpt/config/config.py +++ b/autogpt/config/config.py @@ -25,7 +25,6 @@ class Config(metaclass=Singleton): self.skip_reprompt = False self.allow_downloads = False - self.selenium_web_browser = os.getenv("USE_WEB_BROWSER", "chrome") self.ai_settings_file = os.getenv("AI_SETTINGS_FILE", "ai_settings.yaml") self.fast_llm_model = os.getenv("FAST_LLM_MODEL", "gpt-3.5-turbo") self.smart_llm_model = os.getenv("SMART_LLM_MODEL", "gpt-4") @@ -87,7 +86,11 @@ class Config(metaclass=Singleton): "HUGGINGFACE_AUDIO_TO_TEXT_MODEL" ) - # User agent headers to use when browsing web + # Selenium browser settings + self.selenium_web_browser = os.getenv("USE_WEB_BROWSER", "chrome") + self.selenium_headless = os.getenv("HEADLESS_BROWSER", "True") == "True" + + # User agent header to use when making HTTP requests # Some websites might just completely deny request with an error code if # no user agent was found. self.user_agent = os.getenv( @@ -95,7 +98,7 @@ class Config(metaclass=Singleton): "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_4) AppleWebKit/537.36" " (KHTML, like Gecko) Chrome/83.0.4103.97 Safari/537.36", ) - self.headless_browser = os.getenv('HEADLESS_BROWSER',"True") == "True" + self.redis_host = os.getenv("REDIS_HOST", "localhost") self.redis_port = os.getenv("REDIS_PORT", "6379") self.redis_password = os.getenv("REDIS_PASSWORD", "")