summaryrefslogtreecommitdiffstats
path: root/g4f/Provider/Bing.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/Bing.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 '')
-rw-r--r--g4f/Provider/Bing.py10
1 files changed, 2 insertions, 8 deletions
diff --git a/g4f/Provider/Bing.py b/g4f/Provider/Bing.py
index 751b0d3a..11bb1414 100644
--- a/g4f/Provider/Bing.py
+++ b/g4f/Provider/Bing.py
@@ -11,6 +11,7 @@ from aiohttp import ClientSession, ClientTimeout, BaseConnector
from ..typing import AsyncResult, Messages, ImageType
from ..image import ImageResponse
from .base_provider import AsyncGeneratorProvider
+from .helper import get_connector
from .bing.upload_image import upload_image
from .bing.create_images import create_images
from .bing.conversation import Conversation, create_conversation, delete_conversation
@@ -68,15 +69,8 @@ class Bing(AsyncGeneratorProvider):
cookies = {**Defaults.cookies, **cookies} if cookies else Defaults.cookies
gpt4_turbo = True if model.startswith("gpt-4-turbo") else False
-
- 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')
- return stream_generate(prompt, tone, image, context, cookies, connector, web_search, gpt4_turbo, timeout)
+ return stream_generate(prompt, tone, image, context, cookies, get_connector(connector, proxy), web_search, gpt4_turbo, timeout)
def create_context(messages: Messages) -> str:
"""