From 24add6445548f8f3083d5aa855bffbf51ae0847e Mon Sep 17 00:00:00 2001 From: Karthik Chikmagalur Date: Tue, 3 Oct 2023 09:49:35 -0700 Subject: [PATCH] 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. --- gptel.el | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/gptel.el b/gptel.el index 0871826..a9913ab 100644 --- a/gptel.el +++ b/gptel.el @@ -211,12 +211,8 @@ When clicked, CALLBACK will be called." (gptel--compat)) ;; 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 - `((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.") (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.")) @@ -232,6 +228,9 @@ interactively call `gptel-send' with a prefix argument." :safe #'gptel--always :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 "Max tokens per response.