Is there an elegant way to provide feedback and rechat on the wrong commands and results?
I apologize for my unfamiliarity with this excellent project shell_gpt. An AI provided a command that failed to execute. How can I share the incorrect context in my next conversation?
<logs>
~ sgpt --shell 'check which process using max memo'
ps -eo pid,comm,%mem | sort -nr | head -n 1
[E]xecute, [D]escribe, [A]bort: e
zsh:1: command not found: 41219
</logs>
Then I want to tell ai that The command failed with error: zsh:1: command not found: 41219, please retry..
Is there an elegant way to provide feedback and rechat?
I would be very grateful for your reply.
I do think cli-ai chatting with the (last) stdout result of shell will be a great movement to cli-free.
I have two toy ideas:
- Save the last command and results in some place, but now
run_command()is using theos.system()to run a command, which can not catch the stdout of cli. So I make it change tosubprocess.run(), but this will NOT pass the pytest of@patch(os.system). I'm not sure if I can refactor it. - Let user copy the stdout and chat with clipboard, which is not elegant enought.