From d0da5900c4d79b65a4ede95306530ce538265f05 Mon Sep 17 00:00:00 2001 From: Heiner Lohaus Date: Wed, 27 Mar 2024 19:04:00 +0100 Subject: [PATCH] Fix attr conversation_id not found --- g4f/Provider/needs_auth/OpenaiChat.py | 4 ++-- requirements.txt | 2 +- setup.py | 24 ++++++++++++++++-------- 3 files changed, 19 insertions(+), 11 deletions(-) diff --git a/g4f/Provider/needs_auth/OpenaiChat.py b/g4f/Provider/needs_auth/OpenaiChat.py index 72f9f224..331d524a 100644 --- a/g4f/Provider/needs_auth/OpenaiChat.py +++ b/g4f/Provider/needs_auth/OpenaiChat.py @@ -392,8 +392,8 @@ class OpenaiChat(AsyncGeneratorProvider, ProviderModelMixin): fields = Conversation() if conversation is None else copy(conversation) fields.finish_reason = None while fields.finish_reason is None: - conversation_id = conversation_id if fields.conversation_id is None else fields.conversation_id - parent_id = parent_id if fields.message_id is None else fields.message_id + conversation_id = fields.conversation_id if hasattr(fields, "conversation_id") else conversation_id + parent_id = fields.message_id if hasattr(fields, "message_id") else parent_id websocket_request_id = str(uuid.uuid4()) data = { "action": action, diff --git a/requirements.txt b/requirements.txt index 1c00e099..da7f598a 100644 --- a/requirements.txt +++ b/requirements.txt @@ -20,4 +20,4 @@ aiohttp_socks gpt4all pywebview plyer -pycryptodome \ No newline at end of file +cryptography \ No newline at end of file diff --git a/setup.py b/setup.py index 58fa5ae9..9b3f12d0 100644 --- a/setup.py +++ b/setup.py @@ -20,22 +20,27 @@ EXTRA_REQUIRE = { "curl_cffi>=0.6.2", "certifi", "browser_cookie3", # get_cookies - "PyExecJS", # GptForLove + "PyExecJS", # GptForLove, Vercel "duckduckgo-search>=5.0" ,# internet.search "beautifulsoup4", # internet.search and bing.create_images - "brotli", # openai - #"undetected-chromedriver>=3.5.5", # webdriver - #"setuptools", # webdriver + "brotli", # openai, bing + # webdriver + #"undetected-chromedriver>=3.5.5", + #"setuptools", + #"selenium-wire" + # webview "pywebview", "platformdirs", "plyer", + "cryptography", + #### "aiohttp_socks", # proxy "pillow", # image "cairosvg", # svg image "werkzeug", "flask", # gui - "loguru", "fastapi", + "loguru", "fastapi", # api "uvicorn", "nest_asyncio", # api - #"selenium-wire" + "pycryptodome" # openai ], "image": [ "pillow", @@ -51,9 +56,12 @@ EXTRA_REQUIRE = { "webview": [ "webview", "platformdirs", - "plyer" + "plyer", + "cryptography" + ], + "openai": [ + "pycryptodome" ], - "openai": [], "api": [ "loguru", "fastapi", "uvicorn", "nest_asyncio"