refactor: Replace read-deepseek-api-key with read-llm-api-key

This commit is contained in:
lemyx (aider) 2024-12-29 10:00:06 +08:00
parent 615855244a
commit 191ec90473

View File

@ -13,10 +13,6 @@
(insert-file-contents path) (insert-file-contents path)
(string-trim (buffer-string)))) (string-trim (buffer-string))))
(defun read-deepseek-api-key ()
"Read and return the DeepSeek API key."
(read-llm-api-key (deepseek-api-key-path)))
(use-package gptel (use-package gptel
:ensure t :ensure t
:config :config
@ -26,14 +22,14 @@
:host "api.deepseek.com" :host "api.deepseek.com"
:endpoint "/chat/completions" :endpoint "/chat/completions"
:stream t :stream t
:key (read-deepseek-api-key) :key (read-llm-api-key (deepseek-api-key-path))
:models '("deepseek-chat" "deepseek-coder")))) :models '("deepseek-chat" "deepseek-coder"))))
;; aider.el ;; aider.el
(add-to-list 'load-path "~/.emacs.d/site-lisp/aider/") (add-to-list 'load-path "~/.emacs.d/site-lisp/aider/")
(require 'aider) (require 'aider)
(setq aider-args '("--model" "deepseek/deepseek-coder")) (setq aider-args '("--model" "deepseek/deepseek-coder"))
(setenv "DEEPSEEK_API_KEY" (read-deepseek-api-key)) (setenv "DEEPSEEK_API_KEY" (read-llm-api-key (deepseek-api-key-path)))
(provide 'init-ai) (provide 'init-ai)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;