gptel: Adjust how gptel--system-message is set

* gptel.el (gptel--system-message, gptel-directives): Try to make
gptel--system-message read from gptel-directives.  This doesn't yet work how
we need it to -- changing gptel-directives does not update
gptel--system-message.
This commit is contained in:
Karthik Chikmagalur 2023-10-03 09:49:35 -07:00
parent f0b18c5f8b
commit 24add64455

View file

@ -211,12 +211,8 @@ When clicked, CALLBACK will be called."
(gptel--compat)) (gptel--compat))
;; Model and interaction parameters ;; Model and interaction parameters
(defvar-local gptel--system-message
"You are a large language model living in Emacs and a helpful assistant. Respond concisely.")
(put 'gptel--system-message 'safe-local-variable #'gptel--always)
(defcustom gptel-directives (defcustom gptel-directives
`((default . ,gptel--system-message) '((default . "You are a large language model living in Emacs and a helpful assistant. Respond concisely.")
(programming . "You are a large language model and a careful programmer. Provide code and only code as output without any additional text, prompt or note.") (programming . "You are a large language model and a careful programmer. Provide code and only code as output without any additional text, prompt or note.")
(writing . "You are a large language model and a writing assistant. Respond concisely.") (writing . "You are a large language model and a writing assistant. Respond concisely.")
(chat . "You are a large language model and a conversation partner. Respond concisely.")) (chat . "You are a large language model and a conversation partner. Respond concisely."))
@ -232,6 +228,9 @@ interactively call `gptel-send' with a prefix argument."
:safe #'gptel--always :safe #'gptel--always
:type '(alist :key-type symbol :value-type string)) :type '(alist :key-type symbol :value-type string))
(defvar-local gptel--system-message (alist-get 'default gptel-directives))
(put 'gptel--system-message 'safe-local-variable #'gptel--always)
(defcustom gptel-max-tokens nil (defcustom gptel-max-tokens nil
"Max tokens per response. "Max tokens per response.