tbckr/sgpt

Interactive chat session

tbckr opened this issue · 3 comments

tbckr commented

Introduce an interactive chat session mode via the "-i" flag.

This creates a shell, where one can create an answer directly. The following short commands also exist:

  • explain: this sends the conversation to openai and adds a new user chat message which instructs openai to explain the last command
  • execute: this executes the last message in a shell

Interactive session is not a priority know - issue is closed

I was also interested in a chat support and crafted a bash one-liner that does the trick.

rlwrap bash -c 'echo ▶; while read in; do [[ -n "$in" ]] && echo ■ && sgpt --chat chat_name "$in" && echo ▶; done'

A little bit more details can be found here.

Drop a comment if you have any questions!

@ilya-bystrov This is a really cool and elegant solution - thanks for sharing!

Would you mind documenting your solution in sgpt's documentation? I would like to share it within the docs as well.

If you do not have time for this, I can do it in the next couple of weeks.