Skip to content

Commit

Permalink
fix: 🐛 fix bugs in cookie setting
Browse files Browse the repository at this point in the history
  • Loading branch information
GreyDGL committed May 7, 2023
1 parent c29ebeb commit f4e3bc2
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions config/chatgpt_config_sample.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ class ChatGPTConfig:
model: str = "text-davinci-002-render-sha"

# set up the openai key
openai_key = """<your openai key>"""
openai_key = "<your openai key>"
# set the user-agent below
userAgent: str = """<your user agent>"""
userAgent: str = "<your user agent>"
# set cookie below
cookie: str = """<your cookie>"""
cookie: str = "<your cookie>"

# the following three variables are deprecated
# _puid: str = "user-nwflAg2thlSVHzpBgwGFRgqE:1682153664-6LVyqTDXqHm2QjPWNpXFzDkMFxxv%2Bj%2F0XrgE%2FhdBjeI%3D"
Expand Down
4 changes: 2 additions & 2 deletions utils/chatgpt.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down

0 comments on commit f4e3bc2

Please sign in to comment.