diff --git a/emacs/+chatGPT.el b/emacs/+chatGPT.el deleted file mode 100644 index 1c2646f..0000000 --- a/emacs/+chatGPT.el +++ /dev/null @@ -1,9 +0,0 @@ -(use-package! chatgpt - :defer t - :config - (unless (boundp 'python-interpreter) - (defvaralias 'python-interpreter 'python-shell-interpreter)) - (setq chatgpt-repo-path (expand-file-name "straight/repos/ChatGPT.el/" doom-local-dir)) - (set-popup-rule! (regexp-quote "*ChatGPT*") - :side 'bottom :size .5 :ttl nil :quit t :modeline nil) - :bind ("C-c q" . chatgpt-query)) diff --git a/emacs/+keybinds.el b/emacs/+keybinds.el index 9f16a12..0d050be 100644 --- a/emacs/+keybinds.el +++ b/emacs/+keybinds.el @@ -15,3 +15,15 @@ ) ) ) + +(map! :leader + (:prefix-map ("A" . "GPT") + :desc "Menu" "m" #'gptel-menu + :desc "Menu" "a" #'gptel-menu + :desc "Send" "s" #'gptel-send + :desc "Open Session" "o" #'gptel + :desc "Set Topic" "t" #'gptel-set-topic + :desc "Rewrite" "r" #'gptel-rewrite-menu + :desc "Change Prompt" "c" #'gptel-system-prompt + ) + ) diff --git a/emacs/config.el b/emacs/config.el index cb6d775..b35b367 100644 --- a/emacs/config.el +++ b/emacs/config.el @@ -37,4 +37,5 @@ (load! "+orgmode") -(load! "+chatGPT") + +(use-package! gptel) diff --git a/emacs/config.org b/emacs/config.org index 11b1cf3..baec891 100644 --- a/emacs/config.org +++ b/emacs/config.org @@ -870,42 +870,36 @@ The default =+org-capture/open-frame= is a little small. Let's modify the parame )) #+end_src -** ChatGPT -ChatGPT is good for creating short summaries about technical subjects. Its may be incorrect & does not produce citations, and is effectively just cargo culting, but may help me fill out some Roam docs quickly among other things. +** GPT +GPT is more useful than I thought. Its incredibly helpful for writing prose which I can struggle with due to mild dysgraphia. We will be using the [[https://github.com/karthink/gptel][karthink/gptel]] package. -We will be using the [[https://github.com/joshcho/ChatGPT.el][joshcho/ChatGPT.el]] package - -To install this #+BEGIN_SRC emacs-lisp :tangle "packages.el" -(package! chatgpt - :recipe (:host github :repo "joshcho/ChatGPT.el" :files ("dist" "*.el"))) +(package! gptel) #+END_SRC -Logic for this will be found in =$DOOMDIR/+chatGPT.el= #+begin_src emacs-lisp -(load! "+chatGPT") +(use-package! gptel) #+end_src -Then use =use-package!= to configure. =C-c q= is the bind for this. +This package supports multiple LLM backends. I'm going to be using the OpenAI ChatGPT backend by default. We'll need to set the API key. There are a couple ways this can be done, but we're going to set this using =~/.authinfo.gpg=. This will need to be decrypted before use, but this is pretty minor. -#+begin_src emacs-lisp :tangle "+chatGPT.el" :noweb no-export :comments no -(use-package! chatgpt - :defer t - :config - (unless (boundp 'python-interpreter) - (defvaralias 'python-interpreter 'python-shell-interpreter)) - (setq chatgpt-repo-path (expand-file-name "straight/repos/ChatGPT.el/" doom-local-dir)) - (set-popup-rule! (regexp-quote "*ChatGPT*") - :side 'bottom :size .5 :ttl nil :quit t :modeline nil) - :bind ("C-c q" . chatgpt-query)) +#+begin_src authinfo :tangle no +machine api.openai.com login apikey password TOKEN #+end_src -This runs the =chatgpt.py= file. There are a couple of dependencies, to install run the following: -#+begin_src bash :tangle no -pip install sexpdata==0.0.3 -pip install epc -pip install git+https://github.com/mmabrouk/chatgpt-wrapper -chatgpt install + +#+begin_src emacs-lisp :tangle "+keybinds.el" :noweb no-export :comments no +(map! :leader + (:prefix-map ("A" . "GPT") + :desc "Menu" "m" #'gptel-menu + :desc "Menu" "a" #'gptel-menu + :desc "Send" "s" #'gptel-send + :desc "Open Session" "o" #'gptel + :desc "Set Topic" "t" #'gptel-set-topic + :desc "Rewrite" "r" #'gptel-rewrite-menu + :desc "Change Prompt" "c" #'gptel-system-prompt + ) + ) #+end_src * Content Stolen From A large amount of the details listed here have been lifted from: diff --git a/emacs/packages.el b/emacs/packages.el index fe07ed8..c2da4c9 100644 --- a/emacs/packages.el +++ b/emacs/packages.el @@ -2,5 +2,4 @@ (package! ob-mermaid) -(package! chatgpt - :recipe (:host github :repo "joshcho/ChatGPT.el" :files ("dist" "*.el"))) +(package! gptel)