From 39b0c63fe9279ffef9e317e7754364a62cf9da30 Mon Sep 17 00:00:00 2001 From: Leo Alho Date: Wed, 28 Feb 2024 07:49:34 +0200 Subject: [PATCH 1/2] Add command change_model: --- README.md | 1 + chatgpt.sh | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index b0616ea..de08a67 100644 --- a/README.md +++ b/README.md @@ -125,6 +125,7 @@ This script relies on curl for the requests to the api and jq to parse the json - `history` To view your chat history, type `history` - `models` To get a list of the models available at OpenAI API, type `models` - `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 + - `change_model`: To change the used model type, type `change_model:` and the model `id`. For example `change_model:gpt-4` will change the current model to gpt-4 - `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.* diff --git a/chatgpt.sh b/chatgpt.sh index 81df29a..5f195b7 100755 --- a/chatgpt.sh +++ b/chatgpt.sh @@ -31,7 +31,8 @@ Commands: history - To view your chat history models - To get a list of the models available at OpenAI API 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 - 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. + change_model: - To change the used model. For example "change_model:gpt-4" will change the current model to gpt-4 + 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. @@ -374,6 +375,8 @@ while $running; do model_data=$(echo $models_response | jq -r -C '.data[] | select(.id=="'"${prompt#*model:}"'")') echo -e "$OVERWRITE_PROCESSING_LINE" echo -e "${CHATGPT_CYAN_LABEL}Complete details for model: ${prompt#*model:}\n ${model_data}" + elif [[ "$prompt" =~ ^change_model: ]]; then + MODEL=${prompt#*change_model:} elif [[ "$prompt" =~ ^command: ]]; then # escape quotation marks, new lines, backslashes... escaped_prompt=$(escape "$prompt") From 7cce2784d6c0e7ddf542ee343949a80b820fdfbb Mon Sep 17 00:00:00 2001 From: Leo Alho <46094014+leoalho@users.noreply.github.com> Date: Wed, 28 Feb 2024 07:59:06 +0200 Subject: [PATCH 2/2] Update chatgpt.sh Update formatting of changes --- chatgpt.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/chatgpt.sh b/chatgpt.sh index 5f195b7..05187b8 100755 --- a/chatgpt.sh +++ b/chatgpt.sh @@ -376,7 +376,7 @@ while $running; do echo -e "$OVERWRITE_PROCESSING_LINE" echo -e "${CHATGPT_CYAN_LABEL}Complete details for model: ${prompt#*model:}\n ${model_data}" elif [[ "$prompt" =~ ^change_model: ]]; then - MODEL=${prompt#*change_model:} + MODEL=${prompt#*change_model:} elif [[ "$prompt" =~ ^command: ]]; then # escape quotation marks, new lines, backslashes... escaped_prompt=$(escape "$prompt")