Integrate LLM for enhancement

1. Integrate gptel for general communications
2. Integrate aider.el for coding assistant
3. Adopt deepseek as the backend
This commit is contained in:
lemyx 2024-12-29 10:50:47 +08:00
parent 8012a221c2
commit 8321dbe43b
15 changed files with 47 additions and 17 deletions

3
.gitignore vendored
View File

@ -52,4 +52,5 @@ transient/
projects
eln-cache/
.cache/
history
history
.aider*

6
.gitmodules vendored
View File

@ -13,3 +13,9 @@
[submodule "site-lisp/vertico-posframe"]
path = site-lisp/vertico-posframe
url = https://github.com/tumashu/vertico-posframe.git
[submodule "site-lisp/aider"]
path = site-lisp/aider
url = https://github.com/tninja/aider.el
[submodule "site-lisp/beancount-mode"]
path = site-lisp/beancount-mode
url = https://github.com/beancount/beancount-mode.git

View File

@ -17,6 +17,7 @@
(require 'init-treemacs)
(require 'init-save)
(require 'init-window)
(require 'init-ai)
;; Edit
(require 'init-completion)

View File

@ -33,5 +33,8 @@ npm install -g pyright
pip3 install ruff-lsp --break-system-packages
brew install texlab
# aider
brew install aider
# fetch submodules
git submodule update --init

View File

@ -36,5 +36,10 @@ cargo build --release
# vterm
sudo apt install cmake libtool-bin libvterm-dev
# aider
export PATH="$PATH:$HOME/.local/bin"
python -m pip install aider-install --break-system-packages
aider-install
# fetch submodules
git submodule update --init

View File

@ -5,7 +5,7 @@
(defun deepseek-api-key-path ()
"Return the path to the DeepSeek API key file."
(expand-file-name "~/.config/llm/deepseek/api_key.txt"))
(expand-file-name "~/.dotfiles/llm/deepseek/api_key.txt"))
(defun read-llm-api-key (path)
"Read and return the API key from the specified file path."
@ -18,14 +18,14 @@
(use-package gptel
:ensure t
:config
(setq gptel-model "deepseek-chat")
(setq gptel-model 'deepseek-chat)
(setq gptel-default-mode 'org-mode)
(gptel-set-openai "DeepSeek"
:host "api.deepseek.com"
:endpoint "/chat/completions"
:stream t
:key (read-llm-api-key (deepseek-api-key-path))
:models '("deepseek-chat" "deepseek-coder")))
(setq gptel-backend (gptel-make-openai "DeepSeek"
:host "api.deepseek.com"
:endpoint "/chat/completions"
:stream t
:key (read-llm-api-key (deepseek-api-key-path))
:models '("deepseek-chat" "deepseek-coder"))))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; aider.el

View File

@ -3,7 +3,7 @@
;;; Code:
(add-to-list 'load-path "~/.emacs.d/site-lisp/beancount/")
(add-to-list 'load-path "~/.emacs.d/site-lisp/beancount-mode/")
(require 'beancount)
(add-to-list 'auto-mode-alist '("\\.bean\\'" . beancount-mode))
(add-hook 'beancount-mode-hook

View File

@ -24,9 +24,9 @@
(setq dired-use-ls-dired t)
(setq dired-listing-switches "-al --group-directories-first")
(use-package nerd-icons-dired
:hook
(dired-mode . nerd-icons-dired-mode))
;; (use-package nerd-icons-dired
;; :hook
;; (dired-mode . nerd-icons-dired-mode))
(provide 'init-dired)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

View File

@ -3,6 +3,10 @@
;;; Code:
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; auto-revert
(global-auto-revert-mode 1)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Fluently Edit Large Files
;; https://emacs-china.org/t/topic/25811/6

View File

@ -17,6 +17,8 @@
("\\*corfu.*\\*" :regexp t :ignore t)
("*eshell*" :select t :size 0.4 :align t :popup t)
("*vterm*" :select t :size 0.4 :align t :popup t)
("*DeepSeek*" :select t :size 0.4 :align t :popup t)
(comint-mode :select t :size 0.4 :align t :popup t)
(helpful-mode :select t :size 0.6 :align right :popup t)
("*Messages*" :select t :size 0.4 :align t :popup t)
("*Calendar*" :select t :size 0.3 :align t :popup t)
@ -34,15 +36,18 @@
)
:init
(setq popper-reference-buffers
'("\\*Messages\\*"
'(
"\\*DeepSeek\\*"
comint-mode
"\\*Messages\\*"
"\\*Async Shell Command\\*"
help-mode
helpful-mode
occur-mode
pass-view-mode
"^\\*eshell.*\\*$" eshell-mode ;; eshell as a popup
"^\\*shell.*\\*$" shell-mode ;; shell as a popup
"^\\*vterm*\\*$" vterm-mode ;; vterm as a popup
"^\\*eshell.*\\*$" eshell-mode
"^\\*shell.*\\*$" shell-mode
"^\\*vterm*\\*$" vterm-mode
("\\*corfu\\*" . hide)
(compilation-mode . hide)
;; derived from `fundamental-mode' and fewer than 10 lines will be considered a popup

1
site-lisp/aider Submodule

@ -0,0 +1 @@
Subproject commit a7f21534522a725259cf2efd46837d7bd88ec231

1
site-lisp/auto-save Submodule

@ -0,0 +1 @@
Subproject commit 0fb3c0f38191c0e74f00bae6adaa342de3750e83

@ -0,0 +1 @@
Subproject commit 452621fa1f918d8a105e09d3bd82b2deb45b7146

1
site-lisp/lsp-bridge Submodule

@ -0,0 +1 @@
Subproject commit 402e65f372bb4268c0cd0514a12f0b0e9649c4af

1
site-lisp/one-key Submodule

@ -0,0 +1 @@
Subproject commit b268d8e8591f273a2b2b52da10760b610c8a0bce