diff options
author | H Lohaus <hlohaus@users.noreply.github.com> | 2023-11-16 18:39:34 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-11-16 18:39:34 +0100 |
commit | cbc08d6014efe38cf237f893e0945701e81321fb (patch) | |
tree | dc455789e0473dc5fd90c3057797da61a2c8a62e /g4f | |
parent | Update Phind.py (diff) | |
download | gpt4free-cbc08d6014efe38cf237f893e0945701e81321fb.tar gpt4free-cbc08d6014efe38cf237f893e0945701e81321fb.tar.gz gpt4free-cbc08d6014efe38cf237f893e0945701e81321fb.tar.bz2 gpt4free-cbc08d6014efe38cf237f893e0945701e81321fb.tar.lz gpt4free-cbc08d6014efe38cf237f893e0945701e81321fb.tar.xz gpt4free-cbc08d6014efe38cf237f893e0945701e81321fb.tar.zst gpt4free-cbc08d6014efe38cf237f893e0945701e81321fb.zip |
Diffstat (limited to 'g4f')
-rw-r--r-- | g4f/Provider/helper.py | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/g4f/Provider/helper.py b/g4f/Provider/helper.py index dee27fc4..cad32f05 100644 --- a/g4f/Provider/helper.py +++ b/g4f/Provider/helper.py @@ -42,7 +42,6 @@ except ImportError: from ..typing import Dict, Messages, Union, Tuple from .. import debug -DisplayType = Union[Display, bool] # Change event loop policy on windows if sys.platform == 'win32': @@ -140,23 +139,24 @@ def format_prompt(messages: Messages, add_special_tokens=False) -> str: def get_browser( user_data_dir: str = None, - display: bool = False, - proxy: str = None + hidden_display: bool = False, + proxy: str = None, + options: ChromeOptions = None ) -> Union[Chrome, Tuple[Chrome, Display]] : if user_data_dir == None: user_data_dir = user_config_dir("g4f") - if display: + if hidden_display: display = Display(visible=0, size=(1920, 1080)) display.start() - options = None if proxy: - options = ChromeOptions() - options.add_argument(f'--proxy-server={proxy}') + if not options: + options = ChromeOptions() + options.add_argument(f'--proxy-server={proxy}') browser = Chrome(user_data_dir=user_data_dir, options=options) - if display: + if hidden_display: return browser, display return browser
\ No newline at end of file |