Skip to content

Commit

Permalink
gptel-curl: Fix current-buffer for Curl requests
Browse files Browse the repository at this point in the history
* gptel-curl.el (gptel-curl-get-response): Set buffer-local model parameters in
the correct (i.e. gptel) buffer, not in Curl's process buffer. This fixes #43.
  • Loading branch information
karthink committed Apr 13, 2023
1 parent f218388 commit 444a431
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions gptel-curl.el
Original file line number Diff line number Diff line change
Expand Up @@ -72,13 +72,13 @@ INFO is a plist with the following keys:
Call CALLBACK with the response and INFO afterwards. If omitted
the response is inserted into the current buffer after point."
(with-current-buffer (generate-new-buffer "*gptel-curl*")
(let* ((token (md5 (format "%s%s%s%s"
(random) (emacs-pid) (user-full-name)
(recent-keys))))
(args (gptel-curl--get-args (plist-get info :prompt) token))
(process (apply #'start-process "gptel-curl" (current-buffer)
"curl" args)))
(let* ((token (md5 (format "%s%s%s%s"
(random) (emacs-pid) (user-full-name)
(recent-keys))))
(args (gptel-curl--get-args (plist-get info :prompt) token))
(process (apply #'start-process "gptel-curl"
(generate-new-buffer "*gptel-curl*") "curl" args)))
(with-current-buffer (process-buffer process)
(set-process-query-on-exit-flag process nil)
(setf (alist-get process gptel-curl--process-alist)
(nconc (list :token token
Expand Down

0 comments on commit 444a431

Please sign in to comment.