Package: chatgpt-cli-md
ChatGPT CLI中文IntroductionChatGPT CLI is a command-line interface tool that connects to the ChatGPT language model
using OpenAI's official API key. It features markdown support, allowing you to structure
your inputs in a readable and well-organized format for easier reference. The tool also
saves conversations inJSONformat, you can load them with!loadcommand. Commands
provided enable you to use this tool much like you would use the official web client. For
more command usage, you can type!helpor see more in theCommandssection.Here is a simple demonstration of how to use it:PrequisitesTo run the ChatGPT CLI tool, you'll need to have Python version 3.8 or higher installed on
your machine. You can check your Python version by typingpython -Vin your terminal. We
require version at least3.8because the feature ofimportlib.metadatais only
available from this version. You'll also need an OpenAI API key, which you can easilyget here.The required Python packages can be installed withpip install -r requirements.txt,
which includes the following:openai >= 0.27.0pyyaml >= 6.0rich >= 13.3.1InstallationYou can install ChatGPT CLI by downloading the package from thelatest releaseand running either
of the following commands. Note that you will need to replace<version>with the version
number of the package you downloaded (e.g.0.1.0).You can also install the package from PyPI by runningpip install chatgpt-cli-md.pipinstallchatgpt-cli-md-<version>.tar.gzpipinstallchatgpt_cli_md-<version>-py3-none-any.whlThis will automatically install all the required dependencies. You can also build the
project and get the binary file to install by cloning the repository from GitHub and
running the following commands:gitclonehttps://github.com/efJerryYang/chatgpt-cli.gitInstall necessary dependencies:pipinstall-rrequirements.txtBuild the project into package:python-mbuildOnce built, you can follow the instructions above to install the package. The built
package will be located indistdirectory.We highly recommend that you use the latest version of ChatGPT CLI and install it using
the recommended methods for optimal performance and stability.Getting StartedAfter installation, you can start the ChatGPT CLI tool by typingchatgpt-cliin your
terminal.chatgpt-cliIf you are running the tool for the first time, you will be prompted to configure yourconfig.yamlfile, and you can also import thedatadirectory from your previous script
version. If you do not have a configuration file in the path${HOME}/.config/chatgpt-cli/config.yaml, you can create a new one with the interactive
setup procedure provided by the tool, or you can import the one you have already used in
your previous version. If choose to create a new one, You will need to input your OpenAI
API key and proxy settings (if any). You can also get an OpenAI API keyhereif you do not have one.After configuring your settings, a welcome panel with help information will be displayed,
and you can start chatting with ChatGPT using a variety of commands.A template ofconfig.yamlis shown below:# ChatGPT CLI Configuration Fileopenai:api_key:<YOUR_API_KEY>default_prompt:-role:systemcontent:You are ChatGPT, a language model trained by OpenAI. Now you are responsible for answering any questions the user asks.proxy:http_proxy:http://127.0.0.1:7890https_proxy:http://127.0.0.1:7890You can remove theproxysection or leave its value empty if you do not need to use a
proxy.CommandsWe've provided several commands to help you use this tool more conveniently. You don't
need to remember all of them at once, as you can type!helpwhenever you want to have a
look. The following is a list a available commands:!helpor!h: shows the help message!show: displays the current conversation messages!save: saves the current conversation to aJSONfile!load: loads a conversation from aJSONfile!newor!reset: starts a new conversation!editoror!e: use your default editor (e.g. vim) to submit a message!regen: regenerates the last response!resend: resends your last prompt to generate response!edit: selects messages for editing!drop: selects messages for deletion!exitor!quitor!q: exits the programFeatures (under development):!tmplor!tmpl load: select a template to use!tmpl show: show all templates with complete information!tmpl create: create a new template!tmpl edit: edit an existing template (not implemented yet)!tmpl drop: drop an existing template (not implemented yet)These commands are designed to enable you to use this tool much like you would use the
official web client. If you find that you need additional command support, feel free to
open an issue.TodosWe have some todos for future improvements, such as:Detect[Ctrl]+[C]hotkey and prompt to confirm exiting!token: Count tokens in conversation and display the total number!sum: Generate a summary of the conversation to reduce token usage!tmpl: Choose system prompt templates!conv: Show conversation list, Delete and Rename saved conversations!sys <command>: Enable you to run system commandContributingIf you'd like to contribute to ChatGPT CLI, please feel free to submit a pull request or
open an issue!ReferencesThe idea of using therich.panelpackage comes frommbroton's chatgpt-api.The!sumcommand for generating a summary of the current conversation to guide the
user in continuing the conversation is inspired by 沙漏/u202e.LicenseThis project is licensed under the MIT License - see theLICENSEfile for
details.