acheong08 / ChatGPT

Reverse engineered ChatGPT API
GNU General Public License v2.0
28.01k stars 4.48k forks source link

[Bug]: v1 Setting up a proxy caused an error #1398

Closed 2-3-5-7 closed 1 year ago

2-3-5-7 commented 1 year ago

Is there an existing issue for this?

What happened?

change this line https://github.com/acheong08/ChatGPT/blob/be8624050feee396b7af3583c73d7a55540872ed/src/revChatGPT/V1.py#L158 to self.session.proxies = proxies, fixed the error

Steps to reproduce the problem

from revChatGPT.V1 import Chatbot

chatbot = Chatbot(config={
    "access_token": "XXX",
    "paid": "False",
    "proxy": "127.0.0.1:7890"
})

def start_chat():
    print('Welcome to ChatGPT CLI')
    while True:
        prompt = input('> ')
        response = ""
        for data in chatbot.ask(prompt):
            response = data["message"]
            print(response)

if __name__ == "__main__":
    start_chat()

What should have happened?

No error

Version where the problem happens

5.3.2

What Python version are you running this with?

No response

What is your operating system ?

No response

Command Line Arguments

No

Console logs

Traceback (most recent call last):
  File "D:\Desktop\chat.py", line 3, in <module>
    chatbot = Chatbot(config={
              ^^^^^^^^^^^^^^^^
  File "D:\Desktop\venv\Lib\site-packages\revChatGPT\V1.py", line 65, in wrapper
    out = func(*args, **kwargs)
          ^^^^^^^^^^^^^^^^^^^^^
  File "D:\Desktop\venv\Lib\site-packages\revChatGPT\V1.py", line 158, in __init__
    self.session.proxies.update(proxies)
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'update'

Additional information

No response