promptops / cli

um is a GPT-powered CLI assistant. Ask questions in plain English, get the perfect shell command.
https://promptops.com
GNU General Public License v3.0
122 stars 3 forks source link

`um` context history #7

Open wgordon17 opened 1 year ago

wgordon17 commented 1 year ago

Just wondering if there are plans to have um store context about previous commands?

Ahh, actually I see it in the help output (--history-context) and it defaults to 0. So maybe the enhancement could be parse a written command as opposed to a command line flag.

E.g., when a question starts with "in my last question", or "using the previous output", or something. Mostly just a nice to have, since it's perhaps a bit more intuitive vs a command line flag ¯\_(ツ)_/¯

wgordon17 commented 1 year ago

Actually, it's not clear to me what --history-context is doing. Does it mean that is increases um's context to include previous questions? Or does it mean that it's looking at the last number commands in my local shell's history file, and using that for context?

The request here would be to include previous question context, so that I can say something like "the last command didn't give me what I wanted, can you try filtering out opt in regions?"

jj-ctrlstack commented 1 year ago

Yeah what you are requesting here seems very doable but it's different from the history context. Let me think about how we can have the previous questions injected as context as well (maybe as simple as pick from history?). But, we should definitly clarify in the app or readme what the history context means. Just real quick here, the history context is meant to take the last few commands from the history as extra context. So for example you can do something like

$ curl http://localhost:8080/query\?query\=test
...
$ um use post and convert the params to json body

➜︎ ✨ curl -X POST -H 'Content-Type: application/json' -d '{"query": "test"}' http://localhost:8080/query
   💭️ don't see what you're looking for? try providing more context

(actual output btw) However, I see it's not fully wired. So this one definitely need fixing as well.