Updated chatgpt-shell, added Copilot and PlantUML

This commit is contained in:
Roger Gonzalez 2023-04-19 17:35:59 -03:00
parent 02c34c7780
commit 6b33134d7e
Signed by: rogs
GPG Key ID: C7ECE9C6C36EC2E6
4 changed files with 35 additions and 3 deletions

View File

@ -464,6 +464,10 @@ text and copying to the killring."
("git.suckless.org" nil "git.suckless.org" forge-stagit-repository) ("git.suckless.org" nil "git.suckless.org" forge-stagit-repository)
("git.sr.ht" nil "git.sr.ht" forge-srht-repository))) ("git.sr.ht" nil "git.sr.ht" forge-srht-repository)))
;; Misc
(beacon-mode t)
;; ChatGPT ;; ChatGPT
(require 'chatgpt-shell) (require 'chatgpt-shell)
(require 'ob-chatgpt-shell) (require 'ob-chatgpt-shell)
@ -471,3 +475,26 @@ text and copying to the killring."
(setq chatgpt-shell-chatgpt-model-version "gpt-3.5-turbo") (setq chatgpt-shell-chatgpt-model-version "gpt-3.5-turbo")
(setq chatgpt-shell-chatgpt-streaming "t") (setq chatgpt-shell-chatgpt-streaming "t")
(setq chatgpt-shell-chatgpt-system-prompt "You are a senior Python developer in charge of maintaining a very big application") (setq chatgpt-shell-chatgpt-system-prompt "You are a senior Python developer in charge of maintaining a very big application")
;; Github Copilot
;; accept completion from copilot and fallback to company
;; More info https://robert.kra.hn/posts/2023-02-22-copilot-emacs-setup/
(use-package! copilot
:hook (prog-mode . copilot-mode)
:bind (:map copilot-completion-map
("<tab>" . 'copilot-accept-completion)
("TAB" . 'copilot-accept-completion)
("C-TAB" . 'copilot-accept-completion-by-word)
("C-<tab>" . 'copilot-accept-completion-by-word)))
;; PlantUML
(setq plantuml-executable-path "/usr/bin/plantuml")
(setq plantuml-default-exec-mode 'executable)
(setq org-plantuml-exec-mode 'plantuml)
(setq plantuml-server-url 'nil)
(add-to-list 'org-src-lang-modes '("plantuml" . plantuml))
(org-babel-do-load-languages 'org-babel-load-languages '((plantuml . t)))
(add-to-list 'auto-mode-alist '("\\.plantuml\\'" . plantuml-mode))
(setq org-babel-default-header-args:plantuml
'((:results . "verbatim") (:exports . "results") (:cache . "no")))

View File

@ -58,8 +58,9 @@ This function is called by `org-babel-execute-src-block'"
(message "executing ChatGPT source code block") (message "executing ChatGPT source code block")
(if (map-elt params :preface) (if (map-elt params :preface)
(chatgpt-shell-post-chatgpt-messages (chatgpt-shell-post-chatgpt-messages
(append preface `(((role . "user") (vconcat (map-elt params :preface)
(content . ,body)))) `(((role . "user")
(content . ,body))))
(map-elt params :version)) (map-elt params :version))
(chatgpt-shell-post-chatgpt-prompt body (map-elt params :version)))) (chatgpt-shell-post-chatgpt-prompt body (map-elt params :version))))

View File

@ -21,7 +21,7 @@
;;layout ; auie,ctsrnm is the superior home row ;;layout ; auie,ctsrnm is the superior home row
:completion :completion
company ; the ultimate code completion backend (company +childframe) ; the ultimate code completion backend
helm ; the *other* search engine for love and life helm ; the *other* search engine for love and life
;;ido ; the other *other* search engine... ;;ido ; the other *other* search engine...
ivy ; a search engine for love and life ivy ; a search engine for love and life

View File

@ -61,3 +61,7 @@
(package! dashboard) (package! dashboard)
(package! clipmon) (package! clipmon)
(package! butler) (package! butler)
(package! copilot
:recipe (:host github :repo "zerolfx/copilot.el" :files ("*.el" "dist")))
(package! beacon)
(package! plantuml-mode)