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 <neil@fulwiler.me>
This commit is contained in:
parent
9c4af204a3
commit
4356f6fbec
1 changed files with 3 additions and 1 deletions
4
gptel.el
4
gptel.el
|
@ -402,7 +402,9 @@ Model parameters can be let-bound around calls to this function."
|
||||||
(set-marker (make-marker) position buffer))))
|
(set-marker (make-marker) position buffer))))
|
||||||
(full-prompt
|
(full-prompt
|
||||||
(cond
|
(cond
|
||||||
((null prompt) (gptel--create-prompt start-marker))
|
((null prompt)
|
||||||
|
(let ((gptel--system-message system))
|
||||||
|
(gptel--create-prompt start-marker)))
|
||||||
((stringp prompt)
|
((stringp prompt)
|
||||||
`((:role "system" :content ,system)
|
`((:role "system" :content ,system)
|
||||||
(:role "user" :content ,prompt)))
|
(:role "user" :content ,prompt)))
|
||||||
|
|
Loading…
Add table
Reference in a new issue