▄▄▄▄▄▄▄▄▄▄▄ ▄▄▄▄▄▄▄▄▄▄▄ ▄▄▄▄▄▄▄▄▄▄▄ ▄▄▄▄▄▄▄▄▄▄▄ ▄ ▄▄▄▄▄▄▄▄▄▄▄
▐░░░░░░░░░░░▌▐░░░░░░░░░░░▌▐░░░░░░░░░░░▌ ▐░░░░░░░░░░░▌▐░▌ ▐░░░░░░░░░░░▌
▐░█▀▀▀▀▀▀▀▀▀ ▐░█▀▀▀▀▀▀▀█░▌ ▀▀▀▀█░█▀▀▀▀ ▐░█▀▀▀▀▀▀▀▀▀ ▐░▌ ▀▀▀▀█░█▀▀▀▀
▐░▌ ▐░▌ ▐░▌ ▐░▌ ▐░▌ ▐░▌ ▐░▌
▐░▌ ▄▄▄▄▄▄▄▄ ▐░█▄▄▄▄▄▄▄█░▌ ▐░▌ ▐░▌ ▐░▌ ▐░▌
▐░▌▐░░░░░░░░▌▐░░░░░░░░░░░▌ ▐░▌ ▐░▌ ▐░▌ ▐░▌
▐░▌ ▀▀▀▀▀▀█░▌▐░█▀▀▀▀▀▀▀▀▀ ▐░▌ ▐░▌ ▐░▌ ▐░▌
▐░▌ ▐░▌▐░▌ ▐░▌ ▐░▌ ▐░▌ ▐░▌
▐░█▄▄▄▄▄▄▄█░▌▐░▌ ▐░▌ ▐░█▄▄▄▄▄▄▄▄▄ ▐░█▄▄▄▄▄▄▄▄▄ ▄▄▄▄█░█▄▄▄▄
▐░░░░░░░░░░░▌▐░▌ ▐░▌ ▐░░░░░░░░░░░▌▐░░░░░░░░░░░▌▐░░░░░░░░░░░▌
▀▀▀▀▀▀▀▀▀▀▀ ▀ ▀ ▀▀▀▀▀▀▀▀▀▀▀ ▀▀▀▀▀▀▀▀▀▀▀ ▀▀▀▀▀▀▀▀▀▀▀
Source for ASCII-fonts: https://www.coolgenerator.com/ascii-text-generator (Font: Electronic)
Provide access to GPT 3 model via CLI encapsulated as a docker container.
To stay in the terminal when having a question (e.g. on how a certain command works)
Ensure to have docker installed and running. An OpenAI API key.
The GPT model will be prepared to give answers fitting to your environment and liking. These preferences will be provided together with the API key in a .env file which will be stored inside the docker container. Therefore it is not recommended to upload your image to a public repository.
Create a new .env' file in this root folder of this project. The
.envis listed in the
.gitignore` file and will not be uploaded to the repository.
Feel free to experiment with your own values the perference properties.
Here is an example:
GPT_MODEL = "gpt-4"
# GPT_MODEL = "gpt-3.5-turbo"
TARGET_OS = "Manjaro Linux"
# TARGET_OS = "Arch Linx"
# TARGET_OS = "MacOS"
# TARGET_OS = "Ubuntu"
# HUMOUR_STYLE = "none"
HUMOUR_STYLE = "friendly"
# HUMOUR_STYLE = "friendly ironic"
# HUMOUR_STYLE = "mean sarcastic"
TERMINAL_EMULATOR = "very simple"
# TERMINAL_EMULATOR = "Kitty"
# TERMINAL_EMULATOR = "Alacritty"
# TERMINAL_EMULATOR = "iTerm2"
OPENAI_KEY = "<your OpenAI API key>"
You should have a similar project structure like this:
.
├── dist
├── node_modules
├── src
├── test
├── .vscode
├── .git
├── .env <------------- Your config file
├── .eslintignore
├── .eslintrc.js
├── .gitignore
├── Dockerfile
├── package.json
├── pnpm-lock.yaml
├── README.md
├── gpt-on-cli.code-workspace
└── tsconfig.json
Run the following command inside the project root to create the local docker image:
docker buildx build -t jni-gpt-on-cli .
Alternatively you can run pnpm run build-image
if you have pnpm installed.
Add the following lines to your .zshrc
or .bashrc
file:
# JNI's GPT on CLI
alias ai='docker container run --rm jni-gpt-on-cli'
Pass your quoted question as an argument to the ai
command:
Result of HUMOUR_STYLE = "friendly ironic"
The general usage info reads like this:
Usage: ai [OPTIONS] [STRING]
Options:
-h, --help Show this message and exit.
-v, --version Show version info and exit.
To update all packages to the latest version
pnpm up --latest
to update all packages to the latest version.
To add a new package to the project
pnpm add -D <package>
to add a package to the project. The -D
flag is for development dependencies.
- Add support for different GPT models.
- Tweak colors.
- Better handle unclean answers from GPT model.
- Improve AI prompt.
- Improve output formatting.
- Add color and improve waiting animation.
- General code cleanup and refactoring.
- Initial project version