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! "+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
|
||||
** 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:
|
||||
|
|
|
@ -2,5 +2,4 @@
|
|||
|
||||
(package! ob-mermaid)
|
||||
|
||||
(package! chatgpt
|
||||
:recipe (:host github :repo "joshcho/ChatGPT.el" :files ("dist" "*.el")))
|
||||
(package! gptel)
|
||||
|
|
Loading…
Reference in New Issue
Block a user