summaryrefslogtreecommitdiffstats
path: root/g4f/Provider/Liaobots.py
diff options
context:
space:
mode:
authorHeiner Lohaus <hlohaus@users.noreply.github.com>2024-01-24 00:46:35 +0100
committerHeiner Lohaus <hlohaus@users.noreply.github.com>2024-01-24 00:46:35 +0100
commit69ef224f92fcec3335a857305191678b886651e1 (patch)
treee2eb38fc678c68fa75b06631880172d164a9c7e7 /g4f/Provider/Liaobots.py
parentAdd aiohttp_socks support (diff)
downloadgpt4free-69ef224f92fcec3335a857305191678b886651e1.tar
gpt4free-69ef224f92fcec3335a857305191678b886651e1.tar.gz
gpt4free-69ef224f92fcec3335a857305191678b886651e1.tar.bz2
gpt4free-69ef224f92fcec3335a857305191678b886651e1.tar.lz
gpt4free-69ef224f92fcec3335a857305191678b886651e1.tar.xz
gpt4free-69ef224f92fcec3335a857305191678b886651e1.tar.zst
gpt4free-69ef224f92fcec3335a857305191678b886651e1.zip
Diffstat (limited to 'g4f/Provider/Liaobots.py')
-rw-r--r--g4f/Provider/Liaobots.py9
1 files changed, 2 insertions, 7 deletions
diff --git a/g4f/Provider/Liaobots.py b/g4f/Provider/Liaobots.py
index b16b44d3..e93642ba 100644
--- a/g4f/Provider/Liaobots.py
+++ b/g4f/Provider/Liaobots.py
@@ -6,6 +6,7 @@ from aiohttp import ClientSession, BaseConnector
from ..typing import AsyncResult, Messages
from .base_provider import AsyncGeneratorProvider, ProviderModelMixin
+from .helper import get_connector
models = {
"gpt-4": {
@@ -101,16 +102,10 @@ class Liaobots(AsyncGeneratorProvider, ProviderModelMixin):
"referer": f"{cls.url}/",
"user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/112.0.0.0 Safari/537.36",
}
- if proxy and not connector:
- try:
- from aiohttp_socks import ProxyConnector
- connector = ProxyConnector.from_url(proxy)
- except ImportError:
- raise RuntimeError('Install "aiohttp_socks" package for proxy support')
async with ClientSession(
headers=headers,
cookie_jar=cls._cookie_jar,
- connector=connector
+ connector=get_connector(connector, proxy)
) as session:
cls._auth_code = auth if isinstance(auth, str) else cls._auth_code
if not cls._auth_code: