mirror of
https://github.com/0xacx/chatGPT-shell-cli.git
synced 2024-11-24 11:25:31 +00:00
Merge pull request #13 from 0xacx/add-model-retrieval
Add colors to json response
This commit is contained in:
commit
5d8dcb6ae5
@ -57,14 +57,14 @@ while $running; do
|
||||
-sS \
|
||||
-H "Authorization: Bearer $OPENAI_KEY")
|
||||
handleError "$models_response"
|
||||
models_data=$(echo $models_response | jq -r '.data[] | {id, owned_by, created}')
|
||||
models_data=$(echo $models_response | jq -r -C '.data[] | {id, owned_by, created}')
|
||||
echo -e "\n\033[36mchatgpt \033[0m This is a list of models currently available at OpenAI API:\n ${models_data}"
|
||||
elif [[ "$prompt" =~ ^model: ]]; then
|
||||
models_response=$(curl https://api.openai.com/v1/models \
|
||||
-sS \
|
||||
-H "Authorization: Bearer $OPENAI_KEY")
|
||||
handleError "$models_response"
|
||||
model_data=$(echo $models_response | jq -r '.data[] | select(.id=="'"${prompt#*model:}"'")')
|
||||
model_data=$(echo $models_response | jq -r -C '.data[] | select(.id=="'"${prompt#*model:}"'")')
|
||||
echo -e "\n\033[36mchatgpt \033[0m Complete data for model: ${prompt#*model:}\n ${model_data}"
|
||||
else
|
||||
# escape quotation marks
|
||||
|
Loading…
Reference in New Issue
Block a user