ilse-langnar / bashGPT

Use ChatGPT, GPT-3 and other models from the command line.
9 stars 2 forks source link

Rofi error when running bashGPT #1

Open mmngreco opened 1 year ago

mmngreco commented 1 year ago

Ey!

First of all, thank you. Your project looks pretty neat and it exactly what I was looking for.

Sadly I couldn't make it works, when I run bash bashgpt.sh appears the following error message:

rofi-2023-08-16-0906-00000

I'm afraid I'm not familiar with rofi bindings so not sure what's going on.... any idea?

ilse-langnar commented 1 year ago

Hi, I think this might be related to the way certain keyboards need to have certain modes "on" in order to work. Try changing this line:

rofi_prompt() {
    echo "" | rofi -dmenu -location 0 -i --fixed-num-lines -width 70 -show-icons -show run -config config.rasi -sidebar-mode -          kbclear-line "Mod3+Control+u" -kb-secondary-paste "Mod3+Control+v" -kb-clear-line "Mod3+Control+u" -kb-move-front "Mod3+Control+a" -kb-move-end "Mod3+Control+e" -kb-move-word-back "Mod3+Alt+b" -kb-move-word-forward "Mod3+Alt+f" -kb-move-char-back "Mod3+Left" -kb-move-char-forward "Mod3+Right"-kb-remove-word-back "Mod3+Control+Alt+h" -kb-remove-word-forward "Mod3+Control+Alt+d" -kb-remove-char-forward "Mod3+Delete" -kb-remove-char-back "Mod3+BackSpace,Mod3+Shift+BackSpace,Mod3+Control+BackSpace" -kb-accept-entry "Mod3+Return" -kb-accept-entry-continue "Mod3+Shift+Return" -kb-mode-next "Mod3+Shift+Tab" -kb-mode-previous "Mod3+Shift+Control+Tab" -kb-toggle-case-sensitivity "Mod3+grave" -kb-delete-entry "Mod3+Shift+Delete" -kb-row-left "Mod3+Control+Page_Up" -kb-row-right "Mod3+Control+Page_Down" -kb-row-up "Mod3+Up" -kb-row-down "Mod3+Down" -kb-row-tab "Mod3+Tab" -kb-page-prev "Mod3+Page_Up" -kb-page-next "Mod3+Page_Down" -kb-row-first "Mod3+Home" -kb-row-last "Mod3+End" -kb-row-select "Mod3+Control+space" -kb-cancel "Mod3+Escape" -kb-custom-1 "Mod3+Alt+1" -kb-custom-2 "Mod3+Alt+2" -kb-custom-3 "Mod3+Alt+3" -kb-custom-4 "Mod3+Alt+4" -kb-custom-5 "Mod3+Alt+5" -kb-custom-6 "Mod3+Alt+6" -kb-custom-7 "Mod3+Alt+7" -kb-custom-8 "Mod3+Alt+8" -kb-custom-9 "Mod3+Alt+9" -kb-custom-10 "Mod3+Alt+0" -kb-custom-11 "Mod3+Alt+Shift+1" -kb-custom-12 "Mod3+Alt+Shift+2" -kb-custom-13 "Mod3+Alt+Shift+3" -kb-custom-14 "Mod3+Alt+Shift+4" -kb-custom-15 "Mod3+Alt+Shift+5" -kb-custom-16 "Mod3+Alt+Shift+6" -kb-custom-18 "Mod3+Alt+Shift+8" -       kb-custom-17 "Mod3+Alt+Shift+7" -kb-custom-19 "Mod3+Alt+Shift+9"
 }

to

rofi_prompt() {
     echo "" | rofi -dmenu -location 0 -i --fixed-num-lines -width 70 -show-icons -show run -config config.rasi -sidebar-mode
}

I'll publish the updated version with better handling for "/" and also can be used as "bash gpt.sh "

ilse-langnar commented 1 year ago

Try the new gpt.sh https://raw.githubusercontent.com/ilse-langnar/bashGPT/dev/gpt.sh

mmngreco commented 1 year ago

awesome, now it works as expected! I had to commend espeak as I don't need it. Thank you, Awesome work you've done! :rocket: :100:

Last question: Is this how it should looks like? (I've executed some queries before). If not, never mind I can take a look to it and figure out how to make it fancier ;-)

rofi-2023-08-16-1810-00000

rofi-2023-08-16-1810-00001

rofi-2023-08-16-1810-00002

ilse-langnar commented 1 year ago

Yeah, if you want to: Make it smaller(vertically or horizontally) you can ask ChatGPT to change the rofi settings for you. Are you having problems with backsticks(`)? I'm not sure why bu here it completely messes backsticks. Does it copy to the clipboard normally or does it causes some problem?

Now we need: +Memory +Newlines +History

mmngreco commented 1 year ago

Good idea asking ChatGPT (so obvious). No problems with backticks yet. The copy works perfectly. Sometimes the answer is wrapped with quotes (") so I've added tr -d '"'.

What do you mean with Memory ?

ilse-langnar commented 1 year ago

knowledge of past conversation but I'm not sure how to do it tho. I'm thinking:

if the query starts with ">" it'll take all of the previous ">" as it's memory until a non ">" i found, sort of like "memory blocks".

conversation [ question: answer question: answer question: answer > question: answer // memory block > question: answer // memory block question: answer // stop memory block ]