summaryrefslogtreecommitdiffstats
path: root/g4f/Provider/Bing.py
diff options
context:
space:
mode:
authorH Lohaus <hlohaus@users.noreply.github.com>2024-01-13 15:48:38 +0100
committerGitHub <noreply@github.com>2024-01-13 15:48:38 +0100
commit467f2a6fc67e6c5a6cf996da961dc1f68bd7d456 (patch)
tree70d06c98503a235d8e6727a9ea4537fea4330f8c /g4f/Provider/Bing.py
parent~ (diff)
parentSupport upload image in gui (diff)
downloadgpt4free-467f2a6fc67e6c5a6cf996da961dc1f68bd7d456.tar
gpt4free-467f2a6fc67e6c5a6cf996da961dc1f68bd7d456.tar.gz
gpt4free-467f2a6fc67e6c5a6cf996da961dc1f68bd7d456.tar.bz2
gpt4free-467f2a6fc67e6c5a6cf996da961dc1f68bd7d456.tar.lz
gpt4free-467f2a6fc67e6c5a6cf996da961dc1f68bd7d456.tar.xz
gpt4free-467f2a6fc67e6c5a6cf996da961dc1f68bd7d456.tar.zst
gpt4free-467f2a6fc67e6c5a6cf996da961dc1f68bd7d456.zip
Diffstat (limited to 'g4f/Provider/Bing.py')
-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