Richat is a command-line ChatGPT tool implemented in Ruby that supports highly customizable configuration. It can save chat logs, performs fuzzy searches on historical inputs, allows for prompt customization and switching at any time.
2023-03-30.16.58.51.mov
gem install richat
There are two ways to configure OpenAI API key
- set
OPENAI_API_KEY
env variable - edit
~/.richat/config.json
file and set API key, for example
{
"chatgpt": {
"api_key": "YOUR OPENAI API KEY"
}
}
Then run richat
command to talk with ChatGPT.
Use /config
command to show current configuration.
>> /config
Configuration file path is /Users/fzdp/.richat/config.json
{
"chatgpt": {
"api_key": "YOUR_OPENAI_API_KEY",
"model": "gpt-3.5-turbo",
"temperature": 0.7
},
"log": {
"enable": true,
"log_dir": "~/.richat/logs",
"user_role": "USR",
"ai_role": "GPT",
"system_role": "SYS"
},
"shell": {
"save_history": true,
"enable_chat_context": true,
"show_welcome_info": true,
"history_file": "~/.richat/shell_history.txt"
},
"prompt": {
"prompt_dir": "~/.richat/prompts",
"default": ""
}
}
Edit ~/.richat/config.json
if you need customize configuration.
By default, Richat will log your chat history and log names are in date format.
Set log.enable
to false if you don't need log feature.
You can place prompt files in ~/.richat/prompts
or other directory defined in configure file.
For example, if you place emoji
, linux
, wikipedia
in the directory, then in Richat shell /prompt
command will show these prompt files.
You can use /prompt
command to switch prompt, the argument is prompt file name or prompt file index.
For example if you want to use linux as default prompt, just edit config file
{
"prompt": {
"default": "linux"
}
}
Then Richat shell will use linux prompt when it's run
By default your input history will be saved in ~/.richat/shell_history_file
.
In Richat shell mode, there are three ways to enhance chat experience.
- press TAB to auto complete input
- press Arrow keys to traverse history
- press
Control + R
to fuzzy search input
ChatGPT stream mode is auto enabled in Richat shell mode
2023-03-30.16.04.38.mov
You can run richat
with additional chat content directly
~ richat hello world
Hello! How can I assist you today?
Chat context is enabled by default, because ChatGPT have no memory of past requests, all relevant information must be supplied via the conversation.
You can turn it off in config file.
Bug reports and pull requests are welcome on GitHub at https://github.com/fzdp/richat.
The gem is available as open source under the terms of the MIT License.