gptel: Use :require for auth-source-search (#78)

gptel.el (gptel-api-key-from-auth-source): To read from .authinfo.gpg the key parameter :require for auth-source-search is needed.
This commit is contained in:
Marcus Kammer 2023-06-18 21:10:43 +02:00 committed by GitHub
parent a7207a3835
commit e6df1a5e33
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -229,7 +229,8 @@ To set the temperature for a chat session interactively call
By default, `gptel-host' is used as HOST and \"apikey\" as USER." By default, `gptel-host' is used as HOST and \"apikey\" as USER."
(if-let ((secret (plist-get (car (auth-source-search (if-let ((secret (plist-get (car (auth-source-search
:host (or host gptel-host) :host (or host gptel-host)
:user (or user "apikey"))) :user (or user "apikey")
:require '(:secret)))
:secret))) :secret)))
(if (functionp secret) (if (functionp secret)
(encode-coding-string (funcall secret) 'utf-8) (encode-coding-string (funcall secret) 'utf-8)