diff --git a/aicommit b/aicommit index 15d5068..389fd91 100755 --- a/aicommit +++ b/aicommit @@ -5,7 +5,7 @@ ARGS=("${@-}") TMP_FILE="/tmp/aicommit" system=$( -cat - </dev/null \ No newline at end of file +popd >/dev/null diff --git a/aicommit_groq b/aicommit_groq index 27074e1..e8feb81 100755 --- a/aicommit_groq +++ b/aicommit_groq @@ -5,9 +5,8 @@ set -e ARGS=("${@-}") TMP_FILE="/tmp/aicommit" - system=$( -cat - </dev/null || exit 1 -spin() { - echo "${@}" - while true; do - spinner=('-' '\' '|' '/') - for i in "${spinner[@]}"; do - echo -ne "\r${i}" - sleep .05 - done - done - echo "" -} - if [[ -z ${GROQ_API_KEY} ]]; then echo "API key not set." exit 1 fi - if ! diff=$(git diff --cached); then echo "Failed to get diff." exit 1 @@ -51,8 +37,7 @@ message=$( .stream = false | .stop = null" ) -spin "AI is thinking..." & -SPINNER="$!" + curl -s "https://api.groq.com/openai/v1/chat/completions" \ -X POST \ -H "Content-Type: application/json" \ @@ -61,10 +46,8 @@ curl -s "https://api.groq.com/openai/v1/chat/completions" \ if [[ 0 -ne $? ]]; then echo "Failed to get response." - kill "${SPINNER}" exit 1 fi -kill "${SPINNER}" git commit -e -m "$(cat ${TMP_FILE})" && rm ${TMP_FILE}