summaryrefslogtreecommitdiffstats
path: root/g4f/Provider/needs_auth/Bard.py
diff options
context:
space:
mode:
authorH Lohaus <hlohaus@users.noreply.github.com>2024-01-10 10:34:56 +0100
committerGitHub <noreply@github.com>2024-01-10 10:34:56 +0100
commitbee75be8e38d25c4568c641412a49b576d425b24 (patch)
tree63ea1505dbe2b84c3011164a7b2699e642d94c19 /g4f/Provider/needs_auth/Bard.py
parentMerge pull request #1441 from w453y/patch-1 (diff)
downloadgpt4free-bee75be8e38d25c4568c641412a49b576d425b24.tar
gpt4free-bee75be8e38d25c4568c641412a49b576d425b24.tar.gz
gpt4free-bee75be8e38d25c4568c641412a49b576d425b24.tar.bz2
gpt4free-bee75be8e38d25c4568c641412a49b576d425b24.tar.lz
gpt4free-bee75be8e38d25c4568c641412a49b576d425b24.tar.xz
gpt4free-bee75be8e38d25c4568c641412a49b576d425b24.tar.zst
gpt4free-bee75be8e38d25c4568c641412a49b576d425b24.zip
Diffstat (limited to 'g4f/Provider/needs_auth/Bard.py')
-rw-r--r--g4f/Provider/needs_auth/Bard.py13
1 files changed, 8 insertions, 5 deletions
diff --git a/g4f/Provider/needs_auth/Bard.py b/g4f/Provider/needs_auth/Bard.py
index cf1000c4..aea67874 100644
--- a/g4f/Provider/needs_auth/Bard.py
+++ b/g4f/Provider/needs_auth/Bard.py
@@ -64,11 +64,14 @@ XMLHttpRequest.prototype.open = function(method, url) {
"""
driver.execute_script(script)
- # Submit prompt
- driver.find_element(By.CSS_SELECTOR, "div.ql-editor.textarea").send_keys(prompt)
- driver.find_element(By.CSS_SELECTOR, "div.ql-editor.textarea").send_keys(Keys.ENTER)
-
- # Yield response
+ textarea = driver.find_element(By.CSS_SELECTOR, "div.ql-editor.textarea")
+ lines = prompt.splitlines()
+ for idx, line in enumerate(lines):
+ textarea.send_keys(line)
+ if (len(lines) - 1 != idx):
+ textarea.send_keys(Keys.SHIFT + "\n")
+ textarea.send_keys(Keys.ENTER)
+
while True:
chunk = driver.execute_script("return window._message;")
if chunk: