Skip to content

AI - a commandline ChatGPT (3.5/4) client featuring multiple conversations support, automatic topic identification, image generation and stdin piping (sending files to ChatGPT for inspection)

Notifications You must be signed in to change notification settings

nitefood/ai-bash-gpt

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 

Repository files navigation

AI - a commandline ChatGPT (3.5/4) client in BASH with conversation/completion and image generation support

Features:

  • Interactive chat sessions with OpenAI gpt-3.5-turbo and gpt-4 completion API endpoint models (aka ChatGPT/ChatGPT4) -- note: ChatGPT4 currently requires an API key from a paid OpenAI plan to work

  • Multiline input

  • Image generation support:

    • image preview grid rendered directly in the terminal

    • generate up to 10 images at a time

    • automatic URL shortening

    • optionally save images and prompt to local disk

  • Markdown support for replies (requires glow)

  • One shot Q&A with optional follow-up conversation

  • Data piping support (sending file contents to ChatGPT)

  • Full conversation support:

    • locally store unlimited conversations (in JSON format)

    • quick resume last conversation

    • delete/resume any stored conversation

    • conversation messages replay on resume

    • store current and start new conversation (reset history) during interactive sessions

    • Automatic conversation topic identification and update

Full command line options (ai -h):

  • Note: the -4 optional parameter switches to GPT-4 model.
Start a new interactive conversation:

ai [-4]

One shot Q&A (will ask you to continue interacting, otherwise quit after answer):

ai [-4] "how many planets are there in the solar system?"

Generate one or more images (default 1, max 10):

ai -i [num] "a cute cat"

Submit data as part of the question:

cat file.txt | ai [-4] can you summarize the contents of this file?

List saved conversations:

ai -l

Continue last conversation:

ai [-4] -c

Continue specific conversation:

ai [-4] -c <conversation_id>

Delete a specific conversation:

ai -d <conversation_id>

Delete selected conversations:

ai -d <conversation_id_start>-<conversation_id_end>

Delete all conversations:

rm "$HOME/conversations.json"

Usage examples:

(Interaction and conversation resuming)

asciicast

(Image generation)

asciicast

(Input piping to stdin)

asciicast

Installation:

Prerequisites:
  • Install jq, curl, imagemagick, catimg

    • for e.g. Ubuntu: apt -y install jq curl imagemagick catimg
  • Install glow for Markdown rendering support in your terminal

Script download:

Install the script by either cloning this repository or directly downloading to your $PATH, e.g.:

curl "https://raw.githubusercontent.com/nitefood/ai-bash-gpt/master/ai" > /usr/bin/ai && chmod 0755 /usr/bin/ai

About

AI - a commandline ChatGPT (3.5/4) client featuring multiple conversations support, automatic topic identification, image generation and stdin piping (sending files to ChatGPT for inspection)

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages