gptel-transient: Rename additional-directive functions

* gptel-transient.el (gptel--get-directive,
gptel--infix-add-directive, gptel-menu): Rename the
directive-related functions to be shorter/more consistent with the
rest of the code.

gptel--additional-directive     -> gptel--infix-add-directive
gptel--additional-directive-get -> gptel--get-directive
This commit is contained in:
Karthik Chikmagalur 2024-03-15 15:12:07 -07:00
parent 65dd461f4d
commit 1241224f30

View file

@ -124,7 +124,7 @@ which see."
[""
"Instructions"
("s" "Set system message" gptel-system-prompt :transient t)
(gptel--additional-directive :if (lambda () gptel-expert-commands))]]
(gptel--infix-add-directive :if (lambda () gptel-expert-commands))]]
[["Model Parameters"
(gptel--infix-provider)
;; (gptel--infix-model)
@ -185,7 +185,7 @@ which see."
(lambda ()
"Inspect the query that will be sent as a lisp object."
(interactive)
(let* ((extra (gptel--additional-directive-get
(let* ((extra (gptel--get-directive
(transient-args
transient-current-command)))
(gptel--system-message
@ -196,7 +196,7 @@ which see."
(lambda ()
"Inspect the query that will be sent as a JSON object."
(interactive)
(let* ((extra (gptel--additional-directive-get
(let* ((extra (gptel--get-directive
(transient-args
transient-current-command)))
(gptel--system-message
@ -476,7 +476,7 @@ Also format its value in the Transient menu."
(concat "(" (symbol-name (oref obj display-nil)) ")")
'face 'transient-inactive-value))))
(transient-define-infix gptel--additional-directive ()
(transient-define-infix gptel--infix-add-directive ()
"Additional directive intended for the next query only.
This is useful to define a quick task on top of a more extensive
@ -506,7 +506,7 @@ Or in an extended conversation:
:description "Add directive"
:transient t)
(defun gptel--additional-directive-get (args)
(defun gptel--get-directive (args)
"Find the additional directive in the transient ARGS of this command."
(cl-some (lambda (s) (and (string-prefix-p ":" s)
(concat "\n\n" (substring s 1))))
@ -545,7 +545,7 @@ Or in an extended conversation:
(backend-name (gptel-backend-name gptel-backend))
(buffer) (position)
(callback) (gptel-buffer-name)
(system-extra (gptel--additional-directive-get args))
(system-extra (gptel--get-directive args))
;; Input redirection: grab prompt from elsewhere?
(prompt
(cond