Skip to content
Open
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
8 changes: 5 additions & 3 deletions please.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ fail_msg="echo 'I do not know. Please rephrase your question.'"

declare -a qaMessages=()

user_os="$(uname -s)"
user_shell="$(basename "$SHELL")"

check_args() {
while [[ $# -gt 0 ]]; do
case "${1}" in
Expand Down Expand Up @@ -188,8 +191,7 @@ get_key_from_keychain() {
}

get_command() {
role="You translate the given input into a Linux command. You may not use natural language, but only a Linux shell command as an answer.
Do not use markdown. Do not quote the whole output. If you do not know the answer, answer with \\\"${fail_msg}\\\"."
role="You translate the given input into a shell command for the user's system. The user's operating system is '${user_os}', and their shell is '${user_shell}'. You may not use natural language, but only a shell command as an answer. Do not use markdown. Do not quote the whole output. If you do not know the answer, answer with \\\"${fail_msg}\\\"."

payload=$(printf %s "$commandDescription" | jq --slurp --raw-input --compact-output '{
model: "'"$model"'",
Expand Down Expand Up @@ -411,7 +413,7 @@ copy_to_clipboard() {
}

init_questions() {
systemPrompt="You will give answers in the context of the command \"${command}\" which is a Linux bash command related to the prompt \"${commandDescription}\". Be precise and succinct, answer in full sentences, no lists, no markdown."
systemPrompt="You will give answers in the context of the command \"${command}\" which is a shell command for the user's system (OS: '${user_os}', shell: '${user_shell}') related to the prompt \"${commandDescription}\". Be precise and succinct, answer in full sentences, no lists, no markdown."
escapedPrompt=$(printf %s "${systemPrompt}" | jq -srR '@json')

qaMessages+=("{ \"role\": \"system\", \"content\": ${escapedPrompt} }")
Expand Down