From 4356f6fbece2a697b9e0f53ac1d03381f8148ee3 Mon Sep 17 00:00:00 2001 From: Neil Fulwiler Date: Thu, 13 Jul 2023 18:31:18 -0400 Subject: [PATCH] gptel: correct system message with gptel-request gptel.el (gptel-request): when using `gptel-request', let-bind `gptel--system-message' around call to `gptel--create-prompt' when the prompt argument is null. This allows `gptel-request' to be used to send the buffer as a prompt with a different system message from `gptel--system-message' for that buffer. --------- Co-authored-by: Neil Fulwiler --- gptel.el | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/gptel.el b/gptel.el index a319e5c..a5687e1 100644 --- a/gptel.el +++ b/gptel.el @@ -402,7 +402,9 @@ Model parameters can be let-bound around calls to this function." (set-marker (make-marker) position buffer)))) (full-prompt (cond - ((null prompt) (gptel--create-prompt start-marker)) + ((null prompt) + (let ((gptel--system-message system)) + (gptel--create-prompt start-marker))) ((stringp prompt) `((:role "system" :content ,system) (:role "user" :content ,prompt)))