summaryrefslogtreecommitdiffstats
path: root/g4f/Provider
diff options
context:
space:
mode:
Diffstat (limited to 'g4f/Provider')
-rw-r--r--g4f/Provider/CreateImagesBing.py4
-rw-r--r--g4f/Provider/needs_auth/Gemini.py4
-rw-r--r--g4f/Provider/needs_auth/OpenaiChat.py3
3 files changed, 6 insertions, 5 deletions
diff --git a/g4f/Provider/CreateImagesBing.py b/g4f/Provider/CreateImagesBing.py
index 4d045188..59eafe0c 100644
--- a/g4f/Provider/CreateImagesBing.py
+++ b/g4f/Provider/CreateImagesBing.py
@@ -88,7 +88,7 @@ class CreateImagesBing:
cookies = self.cookies or get_cookies(".bing.com", False)
if "_U" not in cookies:
raise MissingAuthError('Missing "_U" cookie')
- proxy = os.environ.get("G4F_PROXY")
+ proxy = self.proxy or os.environ.get("G4F_PROXY")
async with create_session(cookies, proxy) as session:
- images = await create_images(session, prompt, self.proxy)
+ images = await create_images(session, prompt, proxy)
return ImageResponse(images, prompt, {"preview": "{image}?w=200&h=200"}) \ No newline at end of file
diff --git a/g4f/Provider/needs_auth/Gemini.py b/g4f/Provider/needs_auth/Gemini.py
index 402fc02f..32510505 100644
--- a/g4f/Provider/needs_auth/Gemini.py
+++ b/g4f/Provider/needs_auth/Gemini.py
@@ -66,6 +66,8 @@ class Gemini(AsyncGeneratorProvider):
prompt = format_prompt(messages)
if not cookies:
+ cookies = get_cookies(".google.com", False, True)
+ if "__Secure-1PSID" not in cookies or "__Secure-1PSIDCC" not in cookies:
driver = None
try:
driver = get_browser(proxy=proxy)
@@ -88,8 +90,6 @@ class Gemini(AsyncGeneratorProvider):
if driver:
driver.close()
- if not cookies:
- cookies = get_cookies(".google.com", False)
if "__Secure-1PSID" not in cookies:
raise MissingAuthError('Missing "__Secure-1PSID" cookie')
diff --git a/g4f/Provider/needs_auth/OpenaiChat.py b/g4f/Provider/needs_auth/OpenaiChat.py
index 7c707b5e..b1b267fd 100644
--- a/g4f/Provider/needs_auth/OpenaiChat.py
+++ b/g4f/Provider/needs_auth/OpenaiChat.py
@@ -38,6 +38,7 @@ class OpenaiChat(AsyncGeneratorProvider, ProviderModelMixin):
supports_gpt_4 = True
default_model = None
models = ["gpt-3.5-turbo", "gpt-4", "gpt-4-gizmo"]
+ model_aliases = {"text-davinci-002-render-sha": "gpt-3.5-turbo"}
_cookies: dict = {}
@classmethod
@@ -403,7 +404,7 @@ class OpenaiChat(AsyncGeneratorProvider, ProviderModelMixin):
if "message_type" not in line["message"]["metadata"]:
continue
try:
- image_response = await cls.get_generated_image(session, headers, line)
+ image_response = await cls.get_generated_image(session, auth_headers, line)
if image_response:
yield image_response
except Exception as e: