xenodium / chatgpt-shell

A multi-llm Emacs shell (ChatGPT, Claude, Gemini, Kagi, Ollama, Perplexity) + editing integrations
https://lmno.lol/alvaro
GNU General Public License v3.0
869 stars 77 forks source link

Use completing-read in chatgpt-shell-chatgpt-prompt #37

Closed Lenbok closed 1 year ago

Lenbok commented 1 year ago

Use completing read pre-populated with some example prompts. Works nicely with vertico etc.

xenodium commented 1 year ago

Thanks for the PR! I'll play with it a little and see if I can make it more generic.

xenodium commented 1 year ago

Made it configurable. It uses read-string by default, but can be changed like the following for your use case. Should also help grow the history over time.

(setq chatgpt-shell-read-string-function
      (lambda (prompt history)
        (completing-read prompt (symbol-value history) nil nil nil history)))

edit fixing typos

Lenbok commented 1 year ago

I get funcall-interactively: Symbol’s value as variable is void: chatgpt-shell--chatgpt-prompt-history when calling the function.

xenodium commented 1 year ago

Sorry about that. Try latest again.