Skip to content

Commit

Permalink
gptel: Allow setting custom curl path
Browse files Browse the repository at this point in the history
This commit allows the user to set a custom path to the curl executable.

Windows has some strange notions of what "curl" is, and this can't
always be changed easily. With this variable, a user can let gptel use
the curl executable of their choosing -- allowing full response
streaming.
  • Loading branch information
Ronald Leppink committed Nov 23, 2023
1 parent de6d808 commit 3987ae9
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion gptel-curl.el
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ the response is inserted into the current buffer after point."
(args (gptel-curl--get-args (plist-get info :prompt) token))
(stream (and gptel-stream (gptel-backend-stream gptel-backend)))
(process (apply #'start-process "gptel-curl"
(generate-new-buffer "*gptel-curl*") "curl" args)))
(generate-new-buffer "*gptel-curl*") gptel-curl-path args)))
(when gptel--debug
(message "%S" args))
(with-current-buffer (process-buffer process)
Expand Down
7 changes: 6 additions & 1 deletion gptel.el
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,12 @@ all at once. This wait is asynchronous.
:type 'boolean)
(make-obsolete-variable 'gptel-playback 'gptel-stream "0.3.0")

(defcustom gptel-use-curl (and (executable-find "curl") t)
(defcustom gptel-curl-path "curl"
"The path to the curl executable."
:group 'gptel
:type 'string)

(defcustom gptel-use-curl (and (executable-find gptel-curl-path) t)
"Whether gptel should prefer Curl when available."
:group 'gptel
:type 'boolean)
Expand Down

0 comments on commit 3987ae9

Please sign in to comment.