Adding support for karthink/gptel
This commit is contained in:
parent
7926343cf3
commit
1db9687d66
|
@ -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))
|
|
|
@ -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
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
|
@ -37,4 +37,5 @@
|
||||||
|
|
||||||
(load! "+orgmode")
|
(load! "+orgmode")
|
||||||
|
|
||||||
(load! "+chatGPT")
|
|
||||||
|
(use-package! gptel)
|
||||||
|
|
|
@ -870,42 +870,36 @@ The default =+org-capture/open-frame= is a little small. Let's modify the parame
|
||||||
))
|
))
|
||||||
|
|
||||||
#+end_src
|
#+end_src
|
||||||
** ChatGPT
|
** GPT
|
||||||
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 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"
|
#+BEGIN_SRC emacs-lisp :tangle "packages.el"
|
||||||
(package! chatgpt
|
(package! gptel)
|
||||||
:recipe (:host github :repo "joshcho/ChatGPT.el" :files ("dist" "*.el")))
|
|
||||||
#+END_SRC
|
#+END_SRC
|
||||||
|
|
||||||
Logic for this will be found in =$DOOMDIR/+chatGPT.el=
|
|
||||||
#+begin_src emacs-lisp
|
#+begin_src emacs-lisp
|
||||||
(load! "+chatGPT")
|
(use-package! gptel)
|
||||||
#+end_src
|
#+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
|
#+begin_src authinfo :tangle no
|
||||||
(use-package! chatgpt
|
machine api.openai.com login apikey password TOKEN
|
||||||
: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))
|
|
||||||
#+end_src
|
#+end_src
|
||||||
|
|
||||||
This runs the =chatgpt.py= file. There are a couple of dependencies, to install run the following:
|
|
||||||
#+begin_src bash :tangle no
|
#+begin_src emacs-lisp :tangle "+keybinds.el" :noweb no-export :comments no
|
||||||
pip install sexpdata==0.0.3
|
(map! :leader
|
||||||
pip install epc
|
(:prefix-map ("A" . "GPT")
|
||||||
pip install git+https://github.com/mmabrouk/chatgpt-wrapper
|
:desc "Menu" "m" #'gptel-menu
|
||||||
chatgpt install
|
: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
|
#+end_src
|
||||||
* Content Stolen From
|
* Content Stolen From
|
||||||
A large amount of the details listed here have been lifted from:
|
A large amount of the details listed here have been lifted from:
|
||||||
|
|
|
@ -2,5 +2,4 @@
|
||||||
|
|
||||||
(package! ob-mermaid)
|
(package! ob-mermaid)
|
||||||
|
|
||||||
(package! chatgpt
|
(package! gptel)
|
||||||
:recipe (:host github :repo "joshcho/ChatGPT.el" :files ("dist" "*.el")))
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user