From 2ebbcdf0b81670e2b987e4d44f1efee8f68b3b43 Mon Sep 17 00:00:00 2001 From: Heiner Lohaus Date: Fri, 17 Nov 2023 04:50:37 +0100 Subject: Remove virtualdisplay and add headless mode --- g4f/Provider/PerplexityAi.py | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) (limited to 'g4f/Provider/PerplexityAi.py') diff --git a/g4f/Provider/PerplexityAi.py b/g4f/Provider/PerplexityAi.py index b9de429e..1159840a 100644 --- a/g4f/Provider/PerplexityAi.py +++ b/g4f/Provider/PerplexityAi.py @@ -22,16 +22,10 @@ class PerplexityAi(BaseProvider): timeout: int = 120, browser: WebDriver = None, copilot: bool = False, - hidden_display: bool = True, + headless: bool = True, **kwargs ) -> CreateResult: - if browser: - driver = browser - else: - if hidden_display: - driver, display = get_browser("", True, proxy) - else: - driver = get_browser("", False, proxy) + driver = browser if browser else get_browser("", headless, proxy) from selenium.webdriver.common.by import By from selenium.webdriver.support.ui import WebDriverWait @@ -112,9 +106,7 @@ if(window._message && window._message != window._last_message) { 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 -- cgit v1.2.3