Skip to content

Commit ff85604

Browse files
committed
Update help menu and key not found message
1 parent 3e4c290 commit ff85604

File tree

1 file changed

+24
-18
lines changed

1 file changed

+24
-18
lines changed

chatgpt.sh

Lines changed: 24 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,5 @@
11
#!/bin/bash
22

3-
if [[ -z "$OPENAI_KEY" ]]; then
4-
echo "OPENAI_KEY is not set, exiting"
5-
exit 1
6-
fi
7-
83
GLOBIGNORE="*"
94

105
CHAT_INIT_PROMPT="You are ChatGPT, a Large Language Model trained by OpenAI. You will be answering questions from users. You answer as concisely as possible for each response (e.g. don’t be verbose). If you are generating a list, do not have too many items. Keep the number of items short. Before each user prompt you will be given the chat history in Q&A form. Output your answer directly, with no labels in front. Do not start your answers with A or Anwser. You were trained on data up until 2021. Today's date is $(date +%d/%m/%Y)"
@@ -17,16 +12,28 @@ CHATGPT_CYAN_LABEL="\n\033[36mchatgpt \033[0m"
1712

1813
PROCESSING_LABEL="\033[90mprocessing... \033[0m"
1914

15+
if [[ -z "$OPENAI_KEY" ]]; then
16+
echo "You need to set your OPENAI_KEY to use this script"
17+
echo "You can set it temporarily by running this on your terminal: export OPENAI_KEY=YOUR_KEY_HERE"
18+
exit 1
19+
fi
20+
2021
usage() {
21-
cat << EOF
22-
A simple, lightweight shell script to use OpenAI's chatGPT and DALL-E from the terminal without installing python or node.js.
22+
cat <<EOF
23+
A simple, lightweight shell script to use OpenAI's Language Models and DALL-E from the terminal without installing Python or Node.js. Open Source and written in 100% Shell (Bash)
24+
25+
https://github.com/0xacx/chatGPT-shell-cli/
26+
27+
By default the script uses the "gpt-3.5-turbo" model. It will upgrade to "gpt-4" when the API is accessible to anyone.
2328
2429
Commands:
25-
image - To generate images, start a prompt with image: If you are using iTerm, you can view the image directly in the terminal. Otherwise the script will ask to open the image in your browser.
26-
history - To view your chat history, type history
27-
models - To get a list of the models available at OpenAI API, type models
28-
model - To view all the information on a specific model, start a prompt with model: and the model id as it appears in the list of models. For example: model:text-babbage:001 will get you all the fields for text-babbage:001 model
29-
command - To get a command with the specified functionality and run it, just type command: and explain what you want to achieve. The script will always ask you if you want to execute the command. i.e. command: show me all files in this directory that have more than 150 lines of code If a command modifies your file system or dowloads external files the script will show a warning before executing.
30+
image: - To generate images, start a prompt with image: If you are using iTerm, you can view the image directly in the terminal. Otherwise the script will ask to open the image in your browser.
31+
history - To view your chat history
32+
models - To get a list of the models available at OpenAI API
33+
model: - To view all the information on a specific model, start a prompt with model: and the model id as it appears in the list of models. For example: "model:text-babbage:001" will get you all the fields for text-babbage:001 model
34+
command: - To get a command with the specified functionality and run it, just type "command:" and explain what you want to achieve. The script will always ask you if you want to execute the command. i.e.
35+
"command: show me all files in this directory that have more than 150 lines of code"
36+
*If a command modifies your file system or dowloads external files the script will show a warning before executing.
3037
3138
Options:
3239
-i, --init-prompt - Provide initial chat prompt to use in context
@@ -37,8 +44,7 @@ Options:
3744
--max-tokens - Max number of tokens
3845
-m, --model - Model
3946
-s, --size - Image size. (The sizes that are accepted by the OpenAI API are 256x256, 512x512, 1024x1024)
40-
-c, --chat-context - Make chatgpt aware of todays date and what data it was trained on
41-
47+
-c, --chat-context - For models that do not support chat context by default (all models except gpt-3.5-turbo and gpt-4), you can enable chat context, for the model to remember your previous questions and its previous answers. It also makes models aware of todays date and what data it was trained on.
4248
4349
EOF
4450
}
@@ -231,10 +237,10 @@ while [[ "$#" -gt 0 ]]; do
231237
CONTEXT=true
232238
shift
233239
;;
234-
-h | --help)
235-
usage
236-
exit 0
237-
;;
240+
-h | --help)
241+
usage
242+
exit 0
243+
;;
238244
*)
239245
echo "Unknown parameter: $1"
240246
exit 1

0 commit comments

Comments
 (0)