Skip to content

Commit

Permalink
add more tips
Browse files Browse the repository at this point in the history
  • Loading branch information
liuhuanshuo committed Dec 9, 2022
1 parent 35f03f4 commit a5d7909
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 7 deletions.
20 changes: 17 additions & 3 deletions ChatGPT_PyBot/chatgpt.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@
import cmd
import requests
import json
import os
import uuid
from rich.console import Console
from rich.markdown import Markdown
from OpenAIAuth.OpenAIAuth import OpenAIAuth, Debugger


console = Console()
BASE_URL = "https://chat.openai.com/"

Expand Down Expand Up @@ -316,6 +318,13 @@ def do_exit(self, _):

def main():

file_list = os.listdir(os.getcwd())
if 'config.json' not in file_list:
print("config.json not found in current directory!")
print("Please read the configuration instructions at https://github.com/liuhuanshuo/ChatGPT_PyBot")
print("And make sure that config.json file is available in the current directory!")
exit()

with open("config.json", encoding="utf-8") as f:
config = json.load(f)
if "--debug" in sys.argv:
Expand All @@ -329,11 +338,16 @@ def main():
print("To start ChatGPT, make sure to include the file config.json in the current directory!")
exit()

print("To start ChatGPT, make sure to include the file config.json in the current directory!")
# print("To start ChatGPT, make sure to include the file config.json in the current directory!")
print("Logging in...")
print("")
chatbot = ChatBot(config, debug=debug)

try:
chatbot = ChatBot(config, debug=debug)
except:
print("Error when logging in to OpenAI. Please check the configuration information in config.json is valid.")
print("If you are using an account password for verification, make sure your terminal can access OpenAI, otherwise, use session_token!")
print("More configuration instructions, please refer to https://github.com/liuhuanshuo/ChatGPT_PyBot!")
exit()

if len(sys.argv) > 1 and not help_tips:
response = chatbot.get_chat_response(" ".join(sys.argv[1:]))["message"]
Expand Down
3 changes: 3 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -125,3 +125,6 @@ If you need to call ChatGPT in Python, you can do something like this

This project is inspired by [ChatGPT - A reverse engineering of OpenAI]( https://github.com/acheong08/ChatGPT)

### Disclaimer:

***ChatGPT-PyBot is in no way associated with, endorsed by, or otherwise affiliated with OpenAI.***
8 changes: 4 additions & 4 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
from setuptools import setup, find_packages

with open("readme.md", "r", encoding="utf-8") as fh:
long_description = fh.read()
# with open("readme.md", "r", encoding="utf-8") as fh:
# long_description = fh.read()

setup(
name="ChatGPT_PyBot",
version="0.2.1",
version="0.3",
license="GNU General Public License v2.0",
author="Liuhuanshuo",
author_email="[email protected]",
description="A Python based ChatGPT robot that can be used in the command line",
long_description=long_description,
long_description=open("readme.md", encoding="utf-8").read(),
long_description_content_type="text/markdown",
url="https://github.com/liuhuanshuo/ChatGPT_PyBot",
packages=find_packages(),
Expand Down

0 comments on commit a5d7909

Please sign in to comment.