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..05187b8 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")