C-Loftus / talon-ai-tools

Query LLMs and AI tools with voice commands
http://colton.place/talon-ai-tools/
MIT License
46 stars 17 forks source link

Don't smash shell lines together #9

Closed pokey closed 7 months ago

C-Loftus commented 7 months ago

I have that line since at least in my terminal if I paste text with a new line it will automatically run it. I agree though that we need spaces between, I missed that. In general I don't really like this function, I used to have a Talon command to call it but now I think it is not a good idea to publicly expose.

If you agree, I probably will just remove it regardless and make a shell helper through the copilot interface since I think it is much safer. I could make some sort of preview with imgui before pasting as well, although for accessibility reasons I was hoping to stay away from imgui. Then there is the tradeoff however that we would only be able to do that with in visual studio code, but I think that is okay

pokey commented 7 months ago

make a shell helper through the copilot interface

can you elaborate?

C-Loftus commented 7 months ago
pilot shell <user.text>:

jump to copilot tab 
Paste some automatic prompt boiler plate that signifies it is related to the shell 
insert the rest user text as the rest of the prompt

so the user could say pilot shell print all the files in the current working directory

but maybe this isn't a good idea since even dictating shell commands is kind of difficult at a high level, since it's difficult in one phrase to say everything you want

pokey commented 7 months ago

Maybe add a prompt in the talon list, and as a safety mechanism strip new lines if we detect we're in a terminal?

C-Loftus commented 7 months ago

Yeah so currently we do have something pretty similar, it's just going to obviously be operating upon copied text instead of arbitrary prompts from the user given through the speech command. ( so is pretty safe since its more likely to be used in something like .bashbook but honestly is probably not that useful) I think what I will do honestly is create a safety mechanism through an imgui popup that the user has to explicitly confirm, since I'm a little uncomfortable matching to a terminal tag since I think there are quite a few to match on.

https://github.com/C-Loftus/talon-ai-tools/blob/b2e320a3fefefd7bfe427f177ef8fa8f8d2db5e7/GPT/staticPrompt.talon-list#L24

C-Loftus commented 7 months ago

Pushed some new functionality. I am fairly happy with this, it's good for simple one liners and we don't have to strip any \n or \t or worry about context.

Eventually I will probably integrate this with fzf or shell autocomplete in some capacity, but need to think about a way to do that privately if that is even possible

model shell <user.text>$:
    result = user.gpt_generate_shell(user.text)
    user.add_to_confirmation_gui(result)

# Confirm and paste the output of the model
^paste model output$:
    user.paste_model_confirmation_gui()

^copy model output$:
    user.copy_model_confirmation_gui()

# Deny the output of the model and discard it
^deny model output$:
    user.close_model_confirmation_gui()
pokey commented 7 months ago

Yep just tested and works well! A bit clunky, but if we find ourselves using it a lot we can streamline. See minor comment too https://github.com/C-Loftus/talon-ai-tools/commit/62a1ad117ef5433462eb6dddb59bd6150683688f#r138164479

C-Loftus commented 7 months ago

Thanks for catching that last comment. I forgot to change that when refactoring. Fixed on main now

Yeah, I think for the time being this is probably sufficient for the shell. I will continue looking into some other options for how we may be able to improve UX or extend AI shell functionality with shell integration directly.

Also in general if you think I should be avoiding pushing to main and having someone else review, that is fine with me. Don't want to miss simple stuff like this, but just didn't want to take up anyone's bandwidth. @jaresty do you have any opinions on code review or logistical practices for the repo?

jaresty commented 7 months ago

I think it's probably a good idea, given that we aren't working together directly, to either have a separate development branch or a pull request flow just to keep main stable for casual users.

pokey commented 7 months ago

yeah I think let's go for pull request flow and if it becomes cumbersome we'll revisit. Between the 3 of us I think we can keep things moving