summaryrefslogtreecommitdiffstats
path: root/g4f/Provider/AItianhuSpace.py
diff options
context:
space:
mode:
authorTekky <98614666+xtekky@users.noreply.github.com>2023-11-17 09:28:55 +0100
committerGitHub <noreply@github.com>2023-11-17 09:28:55 +0100
commit053cfa6630a64caac04dbf0bc2aab177224ef807 (patch)
tree095bf4dae94e1b96e2bc2ac638d2608e1f3a4e37 /g4f/Provider/AItianhuSpace.py
parentMerge pull request #1261 from hlohaus/any (diff)
parentUpdate Readme (diff)
downloadgpt4free-053cfa6630a64caac04dbf0bc2aab177224ef807.tar
gpt4free-053cfa6630a64caac04dbf0bc2aab177224ef807.tar.gz
gpt4free-053cfa6630a64caac04dbf0bc2aab177224ef807.tar.bz2
gpt4free-053cfa6630a64caac04dbf0bc2aab177224ef807.tar.lz
gpt4free-053cfa6630a64caac04dbf0bc2aab177224ef807.tar.xz
gpt4free-053cfa6630a64caac04dbf0bc2aab177224ef807.tar.zst
gpt4free-053cfa6630a64caac04dbf0bc2aab177224ef807.zip
Diffstat (limited to 'g4f/Provider/AItianhuSpace.py')
-rw-r--r--g4f/Provider/AItianhuSpace.py17
1 files changed, 5 insertions, 12 deletions
diff --git a/g4f/Provider/AItianhuSpace.py b/g4f/Provider/AItianhuSpace.py
index a9a824cf..545944c0 100644
--- a/g4f/Provider/AItianhuSpace.py
+++ b/g4f/Provider/AItianhuSpace.py
@@ -24,7 +24,7 @@ class AItianhuSpace(BaseProvider):
proxy: str = None,
timeout: int = 120,
browser: WebDriver = None,
- hidden_display: bool = True,
+ headless: bool = True,
**kwargs
) -> CreateResult:
if not model:
@@ -38,13 +38,7 @@ class AItianhuSpace(BaseProvider):
print(f"AItianhuSpace | using domain: {domain}")
url = f"https://{domain}"
prompt = format_prompt(messages)
- if browser:
- driver = browser
- else:
- if hidden_display:
- driver, display = get_browser("", True, proxy)
- else:
- driver = get_browser("", False, proxy)
+ driver = browser if browser else get_browser("", headless, proxy)
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
@@ -66,6 +60,7 @@ document.getElementById('sheet').addEventListener('click', () => {{
original_window = driver.current_window_handle
for window_handle in driver.window_handles:
if window_handle != original_window:
+ driver.close()
driver.switch_to.window(window_handle)
break
@@ -120,9 +115,7 @@ return "";
else:
time.sleep(0.1)
finally:
- driver.close()
if not browser:
+ driver.close()
time.sleep(0.1)
- driver.quit()
- if hidden_display:
- display.stop() \ No newline at end of file
+ driver.quit() \ No newline at end of file