From b12bdaf31d4a4f513d21b282a4000a8dab4ac868 Mon Sep 17 00:00:00 2001 From: Harry Wixley Date: Mon, 3 Jul 2023 17:03:09 +0100 Subject: [PATCH] GPT-commit: Refactor wix-cli.sh for improved commit intelligence. GPT-commit: Refactor wix-cli.sh for improved commit intelligence - Modified wix-cli.sh to enhance commit intelligence feature by implementing changes to specific functions. --- wix-cli.sh | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/wix-cli.sh b/wix-cli.sh index 05ae895..dd87105 100755 --- a/wix-cli.sh +++ b/wix-cli.sh @@ -141,12 +141,21 @@ commit() { if grep -q "OPENAI_API_KEY=" "${datadir}/.env" && grep -q "USE_SMART_COMMIT=true" "${datadir}/.env" ; then IFS=$'\n' lines=($(python3 "$scriptdir/services/openai_service.py" "smart")) h2_text "GPT-3 Suggestion" - h2_text "Title:${RESET} ${lines[0]}" - h2_text "Description:${RESET} ${lines[1]}" - echo "" - info_text "Press enter to use this suggestion or type your own description." - read -r description - git commit -m "${description:-${lines[0]}}" -m "${lines[1]}" + if using_zsh; then + h2_text "Title:${RESET} ${lines[1]}" + h2_text "Description:${RESET} ${lines[2]}" + echo "" + info_text "Press enter to use this suggestion or type your own description." + read -r description + git commit -m "${description:-${lines[1]}}" -m "${lines[2]}" + else + h2_text "Title:${RESET} ${lines[0]}" + h2_text "Description:${RESET} ${lines[1]}" + echo "" + info_text "Press enter to use this suggestion or type your own description." + read -r description + git commit -m "${description:-${lines[0]}}" -m "${lines[1]}" + fi else info_text "Provide a commit description: (defaults to 'wix-cli quick commit')" read -r description