diff options
author | abc <98614666+xtekky@users.noreply.github.com> | 2023-08-27 17:37:44 +0200 |
---|---|---|
committer | abc <98614666+xtekky@users.noreply.github.com> | 2023-08-27 17:37:44 +0200 |
commit | efd75a11b871d61ac31b0e274acdfb33daba361d (patch) | |
tree | 22bd158324444cdbb9dbed46f25f8dffa60f3756 /g4f/Provider/OpenaiChat.py | |
parent | ~ | v-0.0.2.5 (diff) | |
download | gpt4free-efd75a11b871d61ac31b0e274acdfb33daba361d.tar gpt4free-efd75a11b871d61ac31b0e274acdfb33daba361d.tar.gz gpt4free-efd75a11b871d61ac31b0e274acdfb33daba361d.tar.bz2 gpt4free-efd75a11b871d61ac31b0e274acdfb33daba361d.tar.lz gpt4free-efd75a11b871d61ac31b0e274acdfb33daba361d.tar.xz gpt4free-efd75a11b871d61ac31b0e274acdfb33daba361d.tar.zst gpt4free-efd75a11b871d61ac31b0e274acdfb33daba361d.zip |
Diffstat (limited to 'g4f/Provider/OpenaiChat.py')
-rw-r--r-- | g4f/Provider/OpenaiChat.py | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/g4f/Provider/OpenaiChat.py b/g4f/Provider/OpenaiChat.py index cca258b3..c023c898 100644 --- a/g4f/Provider/OpenaiChat.py +++ b/g4f/Provider/OpenaiChat.py @@ -3,16 +3,17 @@ try: from revChatGPT.V1 import AsyncChatbot except ImportError: has_module = False + from .base_provider import AsyncGeneratorProvider, get_cookies -from ..typing import AsyncGenerator +from ..typing import AsyncGenerator class OpenaiChat(AsyncGeneratorProvider): - url = "https://chat.openai.com" - needs_auth = True - working = has_module + url = "https://chat.openai.com" + needs_auth = True + working = has_module supports_gpt_35_turbo = True - supports_gpt_4 = True - supports_stream = True + supports_gpt_4 = True + supports_stream = True @classmethod async def create_async_generator( @@ -36,8 +37,8 @@ class OpenaiChat(AsyncGeneratorProvider): ) if not access_token: - cookies = cookies if cookies else get_cookies("chat.openai.com") - response = await bot.session.get("https://chat.openai.com/api/auth/session", cookies=cookies) + cookies = cookies if cookies else get_cookies("chat.openai.com") + response = await bot.session.get("https://chat.openai.com/api/auth/session", cookies=cookies) access_token = response.json()["accessToken"] bot.set_access_token(access_token) |