summaryrefslogtreecommitdiffstats
path: root/g4f/Provider/You.py
diff options
context:
space:
mode:
authorabc <98614666+xtekky@users.noreply.github.com>2024-05-15 00:45:13 +0200
committerabc <98614666+xtekky@users.noreply.github.com>2024-05-15 00:45:13 +0200
commit1399758a4e000b0fe1cd3d9e86d1a4807d9e41e8 (patch)
treeaabd2aa2013c7526c5e4de0a9dc2e05da81a5a4c /g4f/Provider/You.py
parent. (diff)
downloadgpt4free-1399758a4e000b0fe1cd3d9e86d1a4807d9e41e8.tar
gpt4free-1399758a4e000b0fe1cd3d9e86d1a4807d9e41e8.tar.gz
gpt4free-1399758a4e000b0fe1cd3d9e86d1a4807d9e41e8.tar.bz2
gpt4free-1399758a4e000b0fe1cd3d9e86d1a4807d9e41e8.tar.lz
gpt4free-1399758a4e000b0fe1cd3d9e86d1a4807d9e41e8.tar.xz
gpt4free-1399758a4e000b0fe1cd3d9e86d1a4807d9e41e8.tar.zst
gpt4free-1399758a4e000b0fe1cd3d9e86d1a4807d9e41e8.zip
Diffstat (limited to '')
-rw-r--r--g4f/Provider/You.py20
1 files changed, 15 insertions, 5 deletions
diff --git a/g4f/Provider/You.py b/g4f/Provider/You.py
index e7958f71..b4892035 100644
--- a/g4f/Provider/You.py
+++ b/g4f/Provider/You.py
@@ -1,5 +1,3 @@
-from __future__ import annotations
-
import re
import json
import base64
@@ -24,6 +22,7 @@ class You(AsyncGeneratorProvider, ProviderModelMixin):
image_models = ["dall-e"]
models = [
default_model,
+ "gpt-4o",
"gpt-4",
"gpt-4-turbo",
"claude-instant",
@@ -42,7 +41,8 @@ class You(AsyncGeneratorProvider, ProviderModelMixin):
*image_models
]
model_aliases = {
- "claude-v2": "claude-2"
+ "claude-v2": "claude-2",
+ "gpt-4o": "gpt-4o",
}
_cookies = None
_cookies_used = 0
@@ -99,7 +99,9 @@ class You(AsyncGeneratorProvider, ProviderModelMixin):
"selectedChatMode": chat_mode,
}
if chat_mode == "custom":
+ # print(f"You model: {model}")
params["selectedAIModel"] = model.replace("-", "_")
+
async with (session.post if chat_mode == "default" else session.get)(
f"{cls.url}/api/streamingSearch",
data=data,
@@ -183,7 +185,15 @@ class You(AsyncGeneratorProvider, ProviderModelMixin):
@classmethod
async def create_cookies(cls, client: StreamSession) -> Cookies:
if not cls._telemetry_ids:
- cls._telemetry_ids = await get_telemetry_ids()
+ try:
+ cls._telemetry_ids = await get_telemetry_ids()
+ except RuntimeError as e:
+ if str(e) == "Event loop is closed":
+ if debug.logging:
+ print("Event loop is closed error occurred in create_cookies.")
+ else:
+ raise
+
user_uuid = str(uuid.uuid4())
telemetry_id = cls._telemetry_ids.pop()
if debug.logging:
@@ -212,4 +222,4 @@ class You(AsyncGeneratorProvider, ProviderModelMixin):
'stytch_session_jwt': session["session_jwt"],
'ydc_stytch_session': session["session_token"],
'ydc_stytch_session_jwt': session["session_jwt"],
- }
+ } \ No newline at end of file