From f4e3bc2263ee6b88342a87570c39b1cdd4f3b524 Mon Sep 17 00:00:00 2001 From: Grey_D Date: Sun, 7 May 2023 12:41:15 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=F0=9F=90=9B=20fix=20bugs=20in=20cookie?= =?UTF-8?q?=20setting?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/chatgpt_config_sample.py | 6 +++--- utils/chatgpt.py | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/config/chatgpt_config_sample.py b/config/chatgpt_config_sample.py index 6173a81..7d51423 100644 --- a/config/chatgpt_config_sample.py +++ b/config/chatgpt_config_sample.py @@ -8,11 +8,11 @@ class ChatGPTConfig: model: str = "text-davinci-002-render-sha" # set up the openai key - openai_key = """""" + openai_key = "" # set the user-agent below - userAgent: str = """""" + userAgent: str = "" # set cookie below - cookie: str = """""" + cookie: str = "" # the following three variables are deprecated # _puid: str = "user-nwflAg2thlSVHzpBgwGFRgqE:1682153664-6LVyqTDXqHm2QjPWNpXFzDkMFxxv%2Bj%2F0XrgE%2FhdBjeI%3D" diff --git a/utils/chatgpt.py b/utils/chatgpt.py index f5366b3..f8a0caf 100644 --- a/utils/chatgpt.py +++ b/utils/chatgpt.py @@ -93,8 +93,8 @@ def __init__(self, config: ChatGPTConfig): if "cookie" not in vars(self.config): raise Exception("Please update cookie in config/chatgpt_config.py") self.conversation_dict: Dict[str, Conversation] = {} - self.headers = {"Accept": "*/*", "Cookie": self.config.cookie.replace("\n", "")} - self.headers["User-Agent"] = self.config.userAgent.replace("\n", "") + self.headers = {"Accept": "*/*", "Cookie": self.config.cookie} + self.headers["User-Agent"] = self.config.userAgent self.headers["authorization"] = self.get_authorization() def get_authorization(self):