karthink / gptel

A simple LLM client for Emacs
GNU General Public License v3.0
1.03k stars 111 forks source link

Better prefix-arg behavior for M-x gptel #318

Open karthink opened 1 month ago

karthink commented 1 month ago

Provide a transient menu to create a new chat buffer with a specified backend/model, system message and other parameters. This should be available when gptel is called with a prefix-arg.


@algal This looks good. After trying it for a bit, I think we can simplify the behavior of M-x gptel:

You also don't need to use seq-filter to find the candidates then, and the completing-read will be replaced by

(read-buffer "Create or choose gptel buffer: "
             backend-name nil                         ; DEFAULT and REQUIRE-MATCH
             (lambda (b)                              ; PREDICATE
               (buffer-local-value 'gptel-mode
                                   (get-buffer (or (car-safe b) b)))))

The prefix-arg behavior will then be unnecessary, and we can use it to bring up a transient menu where the user can choose the gptel buffer name, backend, system message and other model parameters to use in the new session. This is a feature that's been asked for a couple of times, and I can add it after this PR.

What do you think?

Originally posted by @karthink in https://github.com/karthink/gptel/issues/311#issuecomment-2118400506