refactor: Rename and generalize read-deepseek-api-key
to read-llm-api-key
This commit is contained in:
parent
beebcb11ee
commit
196f4803eb
@ -7,10 +7,10 @@
|
|||||||
"Return the path to the DeepSeek API key file."
|
"Return the path to the DeepSeek API key file."
|
||||||
(expand-file-name "~/.config/llm/deepseek/api_key.txt"))
|
(expand-file-name "~/.config/llm/deepseek/api_key.txt"))
|
||||||
|
|
||||||
(defun read-deepseek-api-key ()
|
(defun read-llm-api-key (path)
|
||||||
"Read and return the DeepSeek API key from the configured file."
|
"Read and return the DeepSeek API key from the configured file."
|
||||||
(with-temp-buffer
|
(with-temp-buffer
|
||||||
(insert-file-contents (deepseek-api-key-path))
|
(insert-file-contents (path))
|
||||||
(string-trim (buffer-string))))
|
(string-trim (buffer-string))))
|
||||||
|
|
||||||
(use-package gptel
|
(use-package gptel
|
||||||
@ -22,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-deepseek-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-deepseek-api-key()deepseek-api-key-path))
|
||||||
|
|
||||||
(provide 'init-ai)
|
(provide 'init-ai)
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
Loading…
Reference in New Issue
Block a user