gptel: Set gptel-api-key if reading from minibuffer
* gptel.el (gptel): Set `gptel-api-key' if reading it from the minibuffer (by calling M-x gptel).
This commit is contained in:
parent
552939b2f6
commit
f843614f5b
1 changed files with 2 additions and 1 deletions
3
gptel.el
3
gptel.el
|
@ -398,7 +398,8 @@ buffer created or switched to."
|
||||||
(condition-case nil
|
(condition-case nil
|
||||||
(gptel--api-key)
|
(gptel--api-key)
|
||||||
((error user-error)
|
((error user-error)
|
||||||
(read-passwd "OpenAI API key: ")))
|
(setq gptel-api-key
|
||||||
|
(read-passwd "OpenAI API key: "))))
|
||||||
(and (use-region-p)
|
(and (use-region-p)
|
||||||
(buffer-substring (region-beginning)
|
(buffer-substring (region-beginning)
|
||||||
(region-end)))))
|
(region-end)))))
|
||||||
|
|
Loading…
Add table
Reference in a new issue