summaryrefslogtreecommitdiff
path: root/modules/ai-config.el
diff options
context:
space:
mode:
Diffstat (limited to 'modules/ai-config.el')
-rw-r--r--modules/ai-config.el21
1 files changed, 18 insertions, 3 deletions
diff --git a/modules/ai-config.el b/modules/ai-config.el
index 14380a2b..2240d0ac 100644
--- a/modules/ai-config.el
+++ b/modules/ai-config.el
@@ -41,11 +41,26 @@
. "You are a large language model and a careful programmer. Provide code
and only code as output without any additional text, prompt or note.")
(writing
- . "You are a large language model and a writing assistant. Respond concisely.")
+ . "You are a large language model and a writing assistant. Respond
+ concisely.")
(chat
- . "You are a large language model and a conversation partner. Respond concisely.")))
+ . "You are a large language model and a conversation partner. Respond
+ concisely.")))
+ ;; grab the secret from ~/.authinfo.gpg
(setq gptel-api-key (auth-source-pick-first-password :host "api.openai.com")))
+;; ----------------------------- Gptel Send Region -----------------------------
+;; convenience function to send a selection to Gptel.
+
+(defun cj/gptel-send-region (&optional prefix)
+ "Verify a region is selected and call gptel-send with PREFIX."
+ (interactive "P")
+ (if (use-region-p)
+ (gptel-send (prefix-numeric-value prefix))
+ (error "No region selected")))
+
+(global-set-key (kbd "C-; g") 'cj/gptel-send-region)
+
(provide 'ai-config)
-;;; ai-config.el ends here.
+;;; ai-config.el ends here