tiansztiansz / terminal-chatgpt

Can chat with chatgpt in terminal

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

terminal-chatgpt

First of all, it is stated that the code of this warehouse is referenced from this warehouse. I just provide an example here.


how to use

  • Log in to openai and get the token, you can click here to view the details.

  • Install the following packages:

    pip3 install revChatGPT --upgrade
  • Then run the following code:

    python chatgpt.py

Of course, you can also use to build your own system, just like the following code:

from revChatGPT.revChatGPT import Chatbot

# For the config please go here:
# https://github.com/acheong08/ChatGPT/wiki/Setup
config = {"session_token": ""}

def text2text(text):
    chatbot = Chatbot(config, conversation_id=None)
    response = chatbot.get_chat_response(text, output="text")
    result_text = response["message"]
    print("chatgpt: {}\n".format(result_text))
    return result_text

text = "hello world!"
result_text = text2text(text)
print(result_text)

About

Can chat with chatgpt in terminal

License:MIT License


Languages

Language:Python 100.0%