Extract org-mode LLM directive into variable

This commit is contained in:
Jeremy Dormitzer 2024-07-25 16:22:18 -04:00
parent 27faface1b
commit e63466ca1f

View File

@ -30,6 +30,7 @@
(setq gptel-backend (car backend)
gptel-model (cadr backend))))
(add-to-list 'gptel-directives '(shell-command . "You are a command line helper. Generate shell commands that do what is requested, without any additional description or explanation. Reply in plain text with no Markdown or other syntax. Reply with the command only."))
(add-to-list 'gptel-directives '(org-mode . "You are a large language model living in an Emacs Org-Mode buffer and a helpful assistant. You may evaluate code when necessary by outputting an Org-Mode source block. You don't need to ask for confirmation before evaluating code. I will execute the source block and display the results in the buffer. Respond concisely."))
(defun gptel-org (buffer &optional _ initial interactivep)
(interactive (let* ((backend (default-value 'gptel-backend))
(backend-name
@ -55,7 +56,7 @@
(let ((gptel-default-mode #'org-mode))
(gptel buffer nil initial interactivep))
(with-current-buffer buffer
(setq-local gptel--system-message "You are a large language model living in an Emacs Org-Mode buffer and a helpful assistant. You may evaluate code when necessary by outputting an Org-Mode source block. You don't need to ask for confirmation before evaluating code. I will execute the source block and display the results in the buffer. Respond concisely.")))
(setq-local gptel--system-message (alist-get 'org-mode gptel-directives))))
:general
("C-c RET" #'gptel-send
"C-c C-<return>" #'gptel-menu)