Skip to content

Elevate your Terminal's efficiency: harness the unbeatable auto-complete power through seamless ChatGPT integration!

License

Notifications You must be signed in to change notification settings

nicolodiamante/zchat

Repository files navigation

Zchat

Boost your productivity and enhance your terminal experience using Zchat (zch). This command-line productivity tool is powered by OpenAI's ChatGPT models. With Zchat, you don't need to scour the web for Linux commands and code snippets. Simply type in comprehensive language queries and let the system generate the results for you. Zchat's AI capabilities provide precise responses directly in your terminal, saving your time and effort. Additionally, Zchat's intuitive Git integration simplifies your version control processes – bidding farewell to cheat sheets and notes. With Zchat, complete tasks quickly and conveniently.


ChatGPt conbined with the Terminal


Create your OpenAI API Key

To utilise Zchat, you initially need to procure the API key. You can generate this key from your OpenAI account, which will subsequently be used for authentication. Here's how to get your API key:

  1. Sign in to your OpenAI account.
  2. Search for the "Create new secret key" option and select it.

This API key serves as your passport to access and engage with Zchat.

IMG show how to create new secret key

Once you have obtained your API Key, integrating ChatGPT's services with Zchat is straightforward. Note that once you have copied the API Key and closed the pop-up window, you will no longer be able to access and view the key, making it essential that you store it in a secure and safe place.

IMG show an example of a OpenAI API Key


Getting Started

Here are the two methods you can choose from:

Automatic Download via curl: Simply execute the following command in your terminal to quickly download and seamlessly install the utility:

zsh -c "$(curl -fsSL https://raw.githubusercontent.com/nicolodiamante/zchat/HEAD/bootstrap.zsh)"

Manual Cloning: For those who prefer a hands-on approach, you can manually clone the repository:

git clone https://github.com/nicolodiamante/zchat.git ~/zchat

Post-Download Steps

Directory Navigation & Script Execution: Navigate to the root directory of the repository, and then execute the installation script using the following command:

source utils/install.zsh

Zchat Configuration: This script aims to locate the zshrc file, then appends the path zchat/script to the fpath variable, and sets the OPENAI_API_KEY variable.

# Zchat path.
fpath=(~/zchat/script $fpath)
autoload -Uz zchat

Install via Oh My Zsh

git clone https://github.com/nicolodiamante/zchat.git $ZSH_CUSTOM/plugins/zchat
  • Add to your zshrc plugins array plugins=(... zchat)
  • Paste your API Key at the OPENAI_API_KEY variable in your zshrc.
  • Restart the shell to activate.

Setting up dependencies

After completing the installation process, configuration of the Zchat application is required. This step involves inserting the OpenAI API Key into the OPENAI_API_KEY variable located in the .zshrc file. By default, the script uses the GPT-4 Turbo model. However, access to GPT-4 APIs, including both GPT-4 and GPT-4 Turbo, may be limited and generally requires a proven history of successful transactions with OpenAI. If the necessary criteria for accessing GPT-4 or GPT-4 Turbo are not met, or if an alternative model is desired, the script can be adapted to utilise other models, such as GPT-3.5-Turbo. In instances where neither GPT-4 Turbo nor GPT-4 is accessible, opting for GPT-3.5-Turbo is advised.

# Zchat dependencies.
export OPENAI_API_KEY=

For Zchat to function properly, jq must be installed on your operating system. The script will automatically check for this software. If it isn't detected, the script will proceed with the necessary installation.


How to use Zchat

zch <description of task>

Completion

  1. To initiate the completion, simply type 'zch' followed by the command that you want to use for your query.
  2. After formulating your query in natural language, press the 'Enter' key to execute it.



Zchat Completion



Notes

Upon launching Zchat, the script automatically checks whether you're in a Git repository. If it determines that you are, Zchat will present relevant Git commands and provide guidance. If you're not in a Git repository, Zchat assists you in accessing the appropriate command line tools to find the most effective solution for your task.

Resources

OpenAI

Zsh Documentations

Contribution

Thank you for considering using Zchat. Any suggestions or feedback you may have for improvement are welcome. If you encounter any issues or bugs, please report them on the issues page.

Nicolò Diamante Portfolio

MIT License