diff options
author | Heiner Lohaus <hlohaus@users.noreply.github.com> | 2023-11-16 18:10:19 +0100 |
---|---|---|
committer | Heiner Lohaus <hlohaus@users.noreply.github.com> | 2023-11-16 18:10:19 +0100 |
commit | 510f534c0a3cc6219b3b842431b51f505dc3032e (patch) | |
tree | 9207dd0ecebb6cd5faeeda462affcb15cc5e7924 /g4f/Provider/PerplexityAi.py | |
parent | Fix Phind and PerplexityAi - GPT-4 Providers (diff) | |
download | gpt4free-510f534c0a3cc6219b3b842431b51f505dc3032e.tar gpt4free-510f534c0a3cc6219b3b842431b51f505dc3032e.tar.gz gpt4free-510f534c0a3cc6219b3b842431b51f505dc3032e.tar.bz2 gpt4free-510f534c0a3cc6219b3b842431b51f505dc3032e.tar.lz gpt4free-510f534c0a3cc6219b3b842431b51f505dc3032e.tar.xz gpt4free-510f534c0a3cc6219b3b842431b51f505dc3032e.tar.zst gpt4free-510f534c0a3cc6219b3b842431b51f505dc3032e.zip |
Diffstat (limited to 'g4f/Provider/PerplexityAi.py')
-rw-r--r-- | g4f/Provider/PerplexityAi.py | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/g4f/Provider/PerplexityAi.py b/g4f/Provider/PerplexityAi.py index 8bf83b6a..ebb00406 100644 --- a/g4f/Provider/PerplexityAi.py +++ b/g4f/Provider/PerplexityAi.py @@ -14,7 +14,7 @@ from .helper import format_prompt, get_browser class PerplexityAi(BaseProvider): url = "https://www.perplexity.ai" working = True - supports_gpt_4 = True + supports_gpt_35_turbo = True supports_stream = True @classmethod @@ -30,10 +30,6 @@ class PerplexityAi(BaseProvider): display: bool = True, **kwargs ) -> CreateResult: - from selenium.webdriver.common.by import By - from selenium.webdriver.support.ui import WebDriverWait - from selenium.webdriver.support import expected_conditions as EC - if browser: driver = browser else: @@ -42,11 +38,18 @@ class PerplexityAi(BaseProvider): else: driver = get_browser("", False, proxy) + from selenium.webdriver.common.by import By + from selenium.webdriver.support.ui import WebDriverWait + from selenium.webdriver.support import expected_conditions as EC + prompt = format_prompt(messages) driver.get(f"{cls.url}/") wait = WebDriverWait(driver, timeout) + # Page loaded? + wait.until(EC.visibility_of_element_located((By.CSS_SELECTOR, "textarea[placeholder='Ask anything...']"))) + script = """ window._message = window._last_message = ""; window._message_finished = false; @@ -75,9 +78,6 @@ WebSocket.prototype.send = function(...args) { """ driver.execute_script(script) - # Page loaded? - wait.until(EC.visibility_of_element_located((By.CSS_SELECTOR, "textarea[placeholder='Ask anything...']"))) - if copilot: try: driver.find_element(By.CSS_SELECTOR, "img[alt='User avatar']") |