summaryrefslogtreecommitdiffstats
path: root/g4f/Provider/Bing.py
diff options
context:
space:
mode:
authorH Lohaus <hlohaus@users.noreply.github.com>2024-01-13 15:52:52 +0100
committerGitHub <noreply@github.com>2024-01-13 15:52:52 +0100
commitd632190f1d9ff04759a427d1938c0813e918e5e8 (patch)
tree44e3827128489f13fd6fbe7d18171d81176abc86 /g4f/Provider/Bing.py
parentCleanup unused dependencies (diff)
parentMerge pull request #1462 from hlohaus/img (diff)
downloadgpt4free-d632190f1d9ff04759a427d1938c0813e918e5e8.tar
gpt4free-d632190f1d9ff04759a427d1938c0813e918e5e8.tar.gz
gpt4free-d632190f1d9ff04759a427d1938c0813e918e5e8.tar.bz2
gpt4free-d632190f1d9ff04759a427d1938c0813e918e5e8.tar.lz
gpt4free-d632190f1d9ff04759a427d1938c0813e918e5e8.tar.xz
gpt4free-d632190f1d9ff04759a427d1938c0813e918e5e8.tar.zst
gpt4free-d632190f1d9ff04759a427d1938c0813e918e5e8.zip
Diffstat (limited to '')
-rw-r--r--g4f/Provider/Bing.py18
1 files changed, 5 insertions, 13 deletions
diff --git a/g4f/Provider/Bing.py b/g4f/Provider/Bing.py
index b0949397..da9b0172 100644
--- a/g4f/Provider/Bing.py
+++ b/g4f/Provider/Bing.py
@@ -8,11 +8,10 @@ import time
from urllib import parse
from aiohttp import ClientSession, ClientTimeout
-from ..typing import AsyncResult, Messages
+from ..typing import AsyncResult, Messages, ImageType
from .base_provider import AsyncGeneratorProvider
-from ..webdriver import get_browser, get_driver_cookies
from .bing.upload_image import upload_image
-from .bing.create_images import create_images, format_images_markdown, wait_for_login
+from .bing.create_images import create_images, format_images_markdown
from .bing.conversation import Conversation, create_conversation, delete_conversation
class Tones():
@@ -34,7 +33,7 @@ class Bing(AsyncGeneratorProvider):
timeout: int = 900,
cookies: dict = None,
tone: str = Tones.balanced,
- image: str = None,
+ image: ImageType = None,
web_search: bool = False,
**kwargs
) -> AsyncResult:
@@ -247,7 +246,7 @@ def create_message(
async def stream_generate(
prompt: str,
tone: str,
- image: str = None,
+ image: ImageType = None,
context: str = None,
proxy: str = None,
cookies: dict = None,
@@ -315,14 +314,7 @@ async def stream_generate(
result = response['item']['result']
if result.get('error'):
if result["value"] == "CaptchaChallenge":
- driver = get_browser(proxy=proxy)
- try:
- wait_for_login(driver)
- cookies = get_driver_cookies(driver)
- finally:
- driver.quit()
- async for chunk in stream_generate(prompt, tone, image, context, proxy, cookies, web_search, gpt4_turbo, timeout):
- yield chunk
+ raise Exception(f"{result['value']}: Use other cookies or/and ip address")
else:
raise Exception(f"{result['value']}: {result['message']}")
return