Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add new command - current_model #155

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -121,12 +121,13 @@ This script relies on curl for the requests to the api and jq to parse the json
### Commands

- `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.
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.
- `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
- `current_model` To get the name of the current 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. `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.*
*If a command modifies your file system or downloads external files the script will show a warning before executing.*

### Chat context

Expand Down
3 changes: 3 additions & 0 deletions chatgpt.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ Commands:
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.
history - To view your chat history
models - To get a list of the models available at OpenAI API
current_model - To get the name of the current model
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.
"command: show me all files in this directory that have more than 150 lines of code"
Expand Down Expand Up @@ -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" == "current_model" ]]; then
echo "$MODEL"
elif [[ "$prompt" =~ ^command: ]]; then
# escape quotation marks, new lines, backslashes...
escaped_prompt=$(escape "$prompt")
Expand Down