summaryrefslogtreecommitdiffstats
path: root/g4f
diff options
context:
space:
mode:
authorHeiner Lohaus <hlohaus@users.noreply.github.com>2024-02-26 11:25:07 +0100
committerHeiner Lohaus <hlohaus@users.noreply.github.com>2024-02-26 11:25:07 +0100
commit6bbe60572e55d7cdc72a179da3940554128c2c50 (patch)
tree63af777c5a14da968f47ac452f62631702545d8c /g4f
parentImprove filter_messages in gui (diff)
downloadgpt4free-6bbe60572e55d7cdc72a179da3940554128c2c50.tar
gpt4free-6bbe60572e55d7cdc72a179da3940554128c2c50.tar.gz
gpt4free-6bbe60572e55d7cdc72a179da3940554128c2c50.tar.bz2
gpt4free-6bbe60572e55d7cdc72a179da3940554128c2c50.tar.lz
gpt4free-6bbe60572e55d7cdc72a179da3940554128c2c50.tar.xz
gpt4free-6bbe60572e55d7cdc72a179da3940554128c2c50.tar.zst
gpt4free-6bbe60572e55d7cdc72a179da3940554128c2c50.zip
Diffstat (limited to 'g4f')
-rw-r--r--g4f/Provider/Bing.py2
-rw-r--r--g4f/Provider/Liaobots.py2
-rw-r--r--g4f/providers/helper.py3
3 files changed, 3 insertions, 4 deletions
diff --git a/g4f/Provider/Bing.py b/g4f/Provider/Bing.py
index 1e29c4f1..5bc89479 100644
--- a/g4f/Provider/Bing.py
+++ b/g4f/Provider/Bing.py
@@ -70,7 +70,7 @@ class Bing(AsyncGeneratorProvider):
gpt4_turbo = True if model.startswith("gpt-4-turbo") else False
- return stream_generate(prompt, tone, image, context, cookies, get_connector(connector, proxy), web_search, gpt4_turbo, timeout)
+ return stream_generate(prompt, tone, image, context, cookies, get_connector(connector, proxy, True), web_search, gpt4_turbo, timeout)
def create_context(messages: Messages) -> str:
"""
diff --git a/g4f/Provider/Liaobots.py b/g4f/Provider/Liaobots.py
index 54bf7f2e..159c8488 100644
--- a/g4f/Provider/Liaobots.py
+++ b/g4f/Provider/Liaobots.py
@@ -105,7 +105,7 @@ class Liaobots(AsyncGeneratorProvider, ProviderModelMixin):
async with ClientSession(
headers=headers,
cookie_jar=cls._cookie_jar,
- connector=get_connector(connector, proxy)
+ connector=get_connector(connector, proxy, True)
) as session:
cls._auth_code = auth if isinstance(auth, str) else cls._auth_code
if not cls._auth_code:
diff --git a/g4f/providers/helper.py b/g4f/providers/helper.py
index 6981f984..c027216b 100644
--- a/g4f/providers/helper.py
+++ b/g4f/providers/helper.py
@@ -51,11 +51,10 @@ def get_random_hex() -> str:
"""
return secrets.token_hex(16).zfill(32)
-def get_connector(connector: BaseConnector = None, proxy: str = None) -> Optional[BaseConnector]:
+def get_connector(connector: BaseConnector = None, proxy: str = None, rdns: bool = False) -> Optional[BaseConnector]:
if proxy and not connector:
try:
from aiohttp_socks import ProxyConnector
- rdns = False
if proxy.startswith("socks5h://"):
proxy = proxy.replace("socks5h://", "socks5://")
rdns = True