ChatGPT icon indicating copy to clipboard operation
ChatGPT copied to clipboard

[Bug]: I ran the code as per the example, but it's throwing an error.

Open biofer opened this issue 1 year ago • 0 comments

Is there an existing issue for this?

  • [X] I have searched the existing issues and checked the recent builds/commits

What happened?

I ran the code as per the example, but it's throwing an error.

How can I debug my program? Can you please provide some assistance? Thank you very much.

Steps to reproduce the problem

  • chatgpt.py
from revChatGPT.V1 import Chatbot

chatbot = Chatbot(config={
  "email": "****",
  'accessToken': "eyJhbGciOiJka****",
  "password": "*****"
  })

print("Chatbot: ")
prev_text = ""
for data in chatbot.ask(
    "Hello world",
):
    message = data["message"][len(prev_text) :]
    print(message, end="", flush=True)
    prev_text = data["message"]
print()

then python chatgpt.py

What should have happened?

It ran successfully.

Version where the problem happens

Name: revChatGPT Version: 2.2.7 Summary: ChatGPT is a reverse engineering of OpenAI's ChatGPT API Home-page: https://github.com/acheong08/ChatGPT Author: Antonio Cheong Author-email: [email protected] License: GNU General Public License v2.0 Location:/opt/miniconda3/lib/python3.9/site-packages Requires: tiktoken, OpenAIAuth, asyncio, requests, httpx Required-by:

What Python version are you running this with?

Python 3.9.7

What is your operating system ?

MacOS

Command Line Arguments

No

Console logs

Traceback (most recent call last):
  File "/Work/Wechat/ChatGPT/ChatGPT/chatgpt_v1.py", line 5, in <module>
    chatbot = Chatbot(config={
  File "/opt/miniconda3/lib/python3.9/site-packages/revChatGPT/V1.py", line 69, in __init__
    self.__login()
  File "/opt/miniconda3/lib/python3.9/site-packages/revChatGPT/V1.py", line 105, in __login
    auth.get_access_token()
  File "/opt/miniconda3/lib/python3.9/site-packages/OpenAIAuth/OpenAIAuth.py", line 352, in get_access_token
    self.access_token = response.json()["accessToken"]
KeyError: 'accessToken'

Additional information

It runs fine in command line mode.

python3 -m revChatGPT.V1 image

biofer avatar Feb 15 '23 13:02 biofer