diff options
author | Heiner Lohaus <hlohaus@users.noreply.github.com> | 2023-11-17 04:50:37 +0100 |
---|---|---|
committer | Heiner Lohaus <hlohaus@users.noreply.github.com> | 2023-11-17 04:50:37 +0100 |
commit | 2ebbcdf0b81670e2b987e4d44f1efee8f68b3b43 (patch) | |
tree | 5ed9c277ecceb2b90aabb32dd886a7eb704de101 /g4f/Provider/needs_auth/Bard.py | |
parent | Add Poe Provider, Update AItianhuSpace Porvider (diff) | |
download | gpt4free-2ebbcdf0b81670e2b987e4d44f1efee8f68b3b43.tar gpt4free-2ebbcdf0b81670e2b987e4d44f1efee8f68b3b43.tar.gz gpt4free-2ebbcdf0b81670e2b987e4d44f1efee8f68b3b43.tar.bz2 gpt4free-2ebbcdf0b81670e2b987e4d44f1efee8f68b3b43.tar.lz gpt4free-2ebbcdf0b81670e2b987e4d44f1efee8f68b3b43.tar.xz gpt4free-2ebbcdf0b81670e2b987e4d44f1efee8f68b3b43.tar.zst gpt4free-2ebbcdf0b81670e2b987e4d44f1efee8f68b3b43.zip |
Diffstat (limited to '')
-rw-r--r-- | g4f/Provider/needs_auth/Bard.py | 20 |
1 files changed, 5 insertions, 15 deletions
diff --git a/g4f/Provider/needs_auth/Bard.py b/g4f/Provider/needs_auth/Bard.py index 6cb40c90..7f73f1b3 100644 --- a/g4f/Provider/needs_auth/Bard.py +++ b/g4f/Provider/needs_auth/Bard.py @@ -19,17 +19,12 @@ class Bard(BaseProvider): stream: bool, proxy: str = None, browser: WebDriver = None, - hidden_display: bool = True, + user_data_dir: str = None, + headless: bool = True, **kwargs ) -> CreateResult: prompt = format_prompt(messages) - if browser: - driver = browser - else: - if hidden_display: - driver, display = get_browser(None, True, proxy) - else: - driver = get_browser(None, False, proxy) + driver = browser if browser else get_browser(user_data_dir, headless, proxy) from selenium.webdriver.common.by import By from selenium.webdriver.support.ui import WebDriverWait @@ -43,9 +38,6 @@ class Bard(BaseProvider): # Reopen browser for login if not browser: driver.quit() - # New browser should be visible - if hidden_display: - display.stop() driver = get_browser(None, False, proxy) driver.get(f"{cls.url}/chat") wait = WebDriverWait(driver, 240) @@ -83,9 +75,7 @@ XMLHttpRequest.prototype.open = function(method, url) { else: time.sleep(0.1) finally: - driver.close() if not browser: + driver.close() time.sleep(0.1) - driver.quit() - if hidden_display: - display.stop()
\ No newline at end of file + driver.quit()
\ No newline at end of file |