karthink / gptel

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

Change default directive #108

Closed claidler closed 1 year ago

claidler commented 1 year ago

Hi. Thanks for your work here. I've managed to set a list of gptel-directives, via

(setq gptel-directives...

but I can't seem to change the default one - "You are a large language model living in emacs..." Is there a way to set one of the directives in the gptel-directives list to be the default one that open when emacs is first opened?

karthink commented 1 year ago

@claidler This turned out to be quite tricky, I haven't addressed it fully yet. Here's what works right now.


Preferred way to do it (please update gptel first):

Set gptel-directives before gptel is initialized. (In a use-package form this would be in the :init block.) Then the default key of gptel-directives should be the default in all buffers. The net effect should be

(setq gptel-directives
      '((default . "Default directive")
        (programming . "...")
        ;; other keys
        ))
(require 'gptel)        

Direct way to do it, may not be supported in the future:

(setq-default gptel--system-message "My default directive")
claidler commented 1 year ago

Thanks very much for doing this @karthink. I've updated and it's working great!