summaryrefslogtreecommitdiffstats
path: root/g4f/Provider/OpenaiChat.py
diff options
context:
space:
mode:
authorLuneye <73485421+Luneye@users.noreply.github.com>2023-08-28 16:55:36 +0200
committerGitHub <noreply@github.com>2023-08-28 16:55:36 +0200
commit01294db6995511de37e9078e03ce32e54dbdad52 (patch)
treed6c4c14f4e6a3a81660ddb75272bc5da81cacecc /g4f/Provider/OpenaiChat.py
parentUpdate Bing.py (diff)
parent~ | code styling (diff)
downloadgpt4free-01294db6995511de37e9078e03ce32e54dbdad52.tar
gpt4free-01294db6995511de37e9078e03ce32e54dbdad52.tar.gz
gpt4free-01294db6995511de37e9078e03ce32e54dbdad52.tar.bz2
gpt4free-01294db6995511de37e9078e03ce32e54dbdad52.tar.lz
gpt4free-01294db6995511de37e9078e03ce32e54dbdad52.tar.xz
gpt4free-01294db6995511de37e9078e03ce32e54dbdad52.tar.zst
gpt4free-01294db6995511de37e9078e03ce32e54dbdad52.zip
Diffstat (limited to 'g4f/Provider/OpenaiChat.py')
-rw-r--r--g4f/Provider/OpenaiChat.py17
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)