summaryrefslogtreecommitdiffstats
path: root/g4f/Provider/needs_auth/Bard.py
diff options
context:
space:
mode:
authorHeiner Lohaus <hlohaus@users.noreply.github.com>2023-11-17 11:16:49 +0100
committerHeiner Lohaus <hlohaus@users.noreply.github.com>2023-11-17 11:16:49 +0100
commite4caf1d0ca06b83bc0e272eca0e5330feb417f60 (patch)
treea745c83959f02cb903f3a559473e37b379f6af24 /g4f/Provider/needs_auth/Bard.py
parentUpdate Readme (diff)
downloadgpt4free-e4caf1d0ca06b83bc0e272eca0e5330feb417f60.tar
gpt4free-e4caf1d0ca06b83bc0e272eca0e5330feb417f60.tar.gz
gpt4free-e4caf1d0ca06b83bc0e272eca0e5330feb417f60.tar.bz2
gpt4free-e4caf1d0ca06b83bc0e272eca0e5330feb417f60.tar.lz
gpt4free-e4caf1d0ca06b83bc0e272eca0e5330feb417f60.tar.xz
gpt4free-e4caf1d0ca06b83bc0e272eca0e5330feb417f60.tar.zst
gpt4free-e4caf1d0ca06b83bc0e272eca0e5330feb417f60.zip
Diffstat (limited to 'g4f/Provider/needs_auth/Bard.py')
-rw-r--r--g4f/Provider/needs_auth/Bard.py7
1 files changed, 3 insertions, 4 deletions
diff --git a/g4f/Provider/needs_auth/Bard.py b/g4f/Provider/needs_auth/Bard.py
index 7f73f1b3..b1df6909 100644
--- a/g4f/Provider/needs_auth/Bard.py
+++ b/g4f/Provider/needs_auth/Bard.py
@@ -32,7 +32,7 @@ class Bard(BaseProvider):
try:
driver.get(f"{cls.url}/chat")
- wait = WebDriverWait(driver, 10)
+ wait = WebDriverWait(driver, 10 if headless else 240)
wait.until(EC.visibility_of_element_located((By.CSS_SELECTOR, "div.ql-editor.textarea")))
except:
# Reopen browser for login
@@ -61,14 +61,13 @@ XMLHttpRequest.prototype.open = function(method, url) {
"""
driver.execute_script(script)
- # Input and submit prompt
+ # Submit prompt
driver.find_element(By.CSS_SELECTOR, "div.ql-editor.ql-blank.textarea").send_keys(prompt)
driver.find_element(By.CSS_SELECTOR, "button.send-button").click()
# Yield response
- script = "return window._message;"
while True:
- chunk = driver.execute_script(script)
+ chunk = driver.execute_script("return window._message;")
if chunk:
yield chunk
return