/chatgpt-cli

Chat GPT Interactive CLI

Primary LanguageRubyMIT LicenseMIT

ChatGPT CLI

Use this to talk with ChatGPT from your terminal.

Usage

# run app
make run

# general chatting
> hi chatbot

# for usage help
> /help

# generate an image, like a cat. uses the DALL·E model
> /image cat

# see history of conversation so far
> /history

# by default, every message is part of the same context/conversation
# this resets your context/conversation
> /reset

Context

Context is maintained for all chat inputs only. Slash commands are not captured. Use /reset to clear your context.

Prequisites

  1. OpenAI API Key
  2. OpenAI Org ID
  3. Ruby v3+
  4. Bundler v2.3+

Running Using Container

podman run --rm -e OPENAI_ACCESS_TOKEN=rh-35xQDkp8RUynsi6C/XvqU4TdZKbDkR0ehVfI8QMjdkfjJJkd -e OPENAI_ORGANIZATION_ID=org-UZZePtGA6ZXXrwPI3hyZjIEz -it quay.io/jkeam/chatgpt-cli:latest ./run.sh

# or use this image if you are on an m1 mac
# podman run --rm -e OPENAI_ACCESS_TOKEN=rh-35xQDkp8RUynsi6C/XvqU4TdZKbDkR0ehVfI8QMjdkfjJJkd -e OPENAI_ORGANIZATION_ID=org-UZZePtGA6ZXXrwPI3hyZjIEz -it quay.io/jkeam/chatgpt-cli:m1-latest ./run.sh

Running from Source

Setup

  1. Clone project

     git clone git@github.com:jkeam/chatgpt-cli.git
     cd chatgpt-cli
    
  2. Install gems

     gem install bundler
     bundle install
    
  3. Create .env file like below, replacing with your values obtained from Prequisites:

     OPENAI_ACCESS_TOKEN=rh-35xQDkp8RUynsi6C/XvqU4TdZKbDkR0ehVfI8QMjdkfjJJkd
     OPENAI_ORGANIZATION_ID=org-UZZePtGA6ZXXrwPI3hyZjIEz
    

Running

./run.sh
# or make run

Development

# install dev/test dependencies
bundle config set --local with test development

# install test and development dependencies
bundle install

# run tests
make test