summaryrefslogtreecommitdiffstats
path: root/g4f/Provider/needs_auth
diff options
context:
space:
mode:
Diffstat (limited to '')
-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: