Skip to content

Instantly share code, notes, and snippets.

@hookdump
Created April 18, 2023 20:51

Revisions

  1. hookdump created this gist Apr 18, 2023.
    16 changes: 16 additions & 0 deletions .zshrc
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,16 @@
    # Paste your OpenAI API Key here
    export OPENAI_API_KEY="sk-..."

    # Display colors
    RED='\033[0;31m'
    NC='\033[0m' # No Color

    # GPT function
    function gpt {
    set +o nomatch # disable nomatch option
    nvm use gpt --silent # node should be >= 18.13.0, you can use an alias for that version
    local input="$*" # concat args into single string
    echo -e "${RED}Prompt:${NC} $input"
    echo -e "${RED}ChatGPT:${NC}"
    chatgpt "$input" # call chatgpt cli
    }