Skip to content

Instantly share code, notes, and snippets.

@codeasone
Created October 16, 2023 16:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save codeasone/4cf214c1645dbd8a979d4598da97e6c9 to your computer and use it in GitHub Desktop.
Save codeasone/4cf214c1645dbd8a979d4598da97e6c9 to your computer and use it in GitHub Desktop.
Minimal reproduction environment
(require 'package)
(setq package-archives '(("melpa" . "https://melpa.org/packages/")
("elpa" . "https://elpa.gnu.org/packages/")))
(setq package-archive-priorities '(("melpa" . 10) ("elpa" . 5)))
(use-package org-roam
:ensure t
:demand t
:custom
(org-roam-directory (expand-file-name "~/Documents/Org")))
(use-package auth-source-pass
:demand t
:config
(cl-defun
auth-get-passwd
(&rest spec &allow-other-keys)
"Helper to get the password given the SPEC from authsource."
(let ((founds (apply 'auth-source-pass-search spec)))
(when founds
(funcall (plist-get (nth 0 founds) :secret)))))
(auth-source-pass-enable))
(use-package gptel
:ensure t
:hook (org-mode . gptel-mode)
:custom
(gptel-default-mode 'org-mode)
(gptel-model "gpt-4")
(gptel-api-key (auth-get-passwd :host "openai.com" :user "codeasone"))
(gptel-prompt-prefix-alist
'((markdown-mode . "# ")
(org-mode . "* ")
(text-mode . "# "))
:group 'gptel
:type '(alist :key-type symbol :value-type string)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment