summaryrefslogtreecommitdiffstats
path: root/g4f/Provider/PerplexityAi.py
diff options
context:
space:
mode:
Diffstat (limited to 'g4f/Provider/PerplexityAi.py')
-rw-r--r--g4f/Provider/PerplexityAi.py16
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']")