gptel: Show chosen system message in header-line
* gptel.el (gptel): Show chosen system message in header-line (#274). Remove the context indicator `[Send: ...]`, as this needs to be reworked for the upcoming context-inclusion features anyway. * gptel-transient.el (gptel-system-prompt): Autoload `gptel-system-prompt`, this is required for the gptel header-line.
This commit is contained in:
parent
53ee34653e
commit
53a905dafc
2 changed files with 11 additions and 10 deletions
|
@ -404,6 +404,7 @@ Also format its value in the Transient menu."
|
|||
;; instead of returning to the system prompt menu.
|
||||
:transient 'transient--do-exit))))))
|
||||
|
||||
;;;###autoload (autoload 'gptel-system-prompt "gptel-transient" nil t)
|
||||
(transient-define-prefix gptel-system-prompt ()
|
||||
"Set the LLM system message for LLM interactions in this buffer.
|
||||
|
||||
|
|
20
gptel.el
20
gptel.el
|
@ -108,6 +108,7 @@
|
|||
(declare-function markdown-mode "markdown-mode")
|
||||
(declare-function gptel-curl-get-response "gptel-curl")
|
||||
(declare-function gptel-menu "gptel-transient")
|
||||
(declare-function gptel-system-prompt "gptel-transient")
|
||||
(declare-function pulse-momentary-highlight-region "pulse")
|
||||
|
||||
;; Functions used for saving/restoring gptel state in Org buffers
|
||||
|
@ -773,21 +774,20 @@ file."
|
|||
(format "%s" (gptel-backend-name gptel-backend))))
|
||||
(propertize " Ready" 'face 'success)
|
||||
'(:eval
|
||||
(let* ((l1 (length gptel-model))
|
||||
(num-exchanges
|
||||
(if gptel--num-messages-to-send
|
||||
(format "[Send: %s exchanges]" gptel--num-messages-to-send)
|
||||
"[Send: buffer]"))
|
||||
(l2 (length num-exchanges)))
|
||||
(let ((system
|
||||
(format "[Prompt: %s]"
|
||||
(or (car-safe (rassoc gptel--system-message gptel-directives))
|
||||
(truncate-string-to-width gptel--system-message 15 nil nil t)))))
|
||||
(concat
|
||||
(propertize
|
||||
" " 'display `(space :align-to ,(max 1 (- (window-width) (+ 2 l1 l2)))))
|
||||
" " 'display
|
||||
`(space :align-to (- right ,(+ 2 (length gptel-model) (length system)))))
|
||||
(propertize
|
||||
(buttonize num-exchanges
|
||||
(lambda (&rest _) (gptel-menu)))
|
||||
(buttonize system
|
||||
(lambda (&rest _) (gptel-system-prompt)))
|
||||
'mouse-face 'highlight
|
||||
'help-echo
|
||||
"Number of past exchanges to include with each request")
|
||||
"System message for buffer")
|
||||
" "
|
||||
(propertize
|
||||
(buttonize (concat "[" gptel-model "]")
|
||||
|
|
Loading…
Add table
Reference in a new issue