@ -5,7 +5,7 @@ CHAT_INIT_PROMPT="You are ChatGPT, a Large Language Model trained by OpenAI. You
SYSTEM_PROMPT="You are ChatGPT, a large language model trained by OpenAI. Answer as concisely as possible. Current date: $(date +%d/%m/%Y). Knowledge cutoff: 9/1/2021."
COMMAND_GENERATION_PROMPT="Return a one-line bash command with the functionality I will describe. Your output must follow this format \`command: the-actual-command\` and should be only the command, no quotes or other text. The command should do the following:"
COMMAND_GENERATION_PROMPT="Return a one-line bash command with the functionality I will describe. Return ONLY the command ready to run in the terminal. The command should do the following:"
EXPLAIN_CODE_PROMPT="Explain in great detail, step by step the following code. Identify any dependencies, libraries, software packages. If you find any errors suggest a solution. Try to guess the context and application it is used on. This is the code:"
@ -215,20 +215,21 @@ CONTEXT=${CONTEXT:-false}
# create history file
if[ ! -f ~/.chatgpt_history ];then
touch ~/.chatgpt_history
chmod a+rw ~/.chatgpt_history
chmod 600 ~/.chatgpt_history
fi
running=true
# check input source
# if prompt already entered, run on pipe mode (run once, no chat)
# prompt from pipe
if[ -p /dev/stdin ];then
pipe_mode_prompt+=$(cat -)
# prompt from argument
elif[ -n "$prompt"];then
# check input source and determine run mode
# prompt from argument, run on pipe mode (run once, no chat)
if[ -n "$prompt"];then
pipe_mode_prompt=${prompt}
else
# if input file_descriptor is a terminal, run on chat mode
elif[ -t 0];then
echo -e "Welcome to chatgpt. You can quit with '\033[36mexit\033[0m' or '\033[36mq\033[0m'."
# prompt from pipe or redirected stdin, run on pipe mode
echo"Warning! This command can change your file system or download external scripts & data. Please do not execute code that you don't understand completely."