gptel-curl: Tweak Curl arguments for windows

gptel-curl.el (gptel-curl--common-args, gptel-curl--get-args):
Don't use compression with Curl on Windows, since it seems to
be generally not supported. Fix #90.
This commit is contained in:
Karthik Chikmagalur 2023-12-09 19:34:29 -08:00
parent 3e361323d5
commit 5c3b26aeec

View file

@ -34,6 +34,14 @@
(require 'map) (require 'map)
(require 'json) (require 'json)
(defconst gptel-curl--common-args
(if (memq system-type '(windows-nt ms-dos))
'("--disable" "--location" "--silent" "-XPOST"
"-m300" "-D-")
'("--disable" "--location" "--silent" "--compressed"
"-XPOST" "-m300" "-D-"))
"Arguments always passed to Curl for gptel queries.")
(defvar gptel-curl--process-alist nil (defvar gptel-curl--process-alist nil
"Alist of active GPTel curl requests.") "Alist of active GPTel curl requests.")
@ -52,11 +60,8 @@ PROMPTS is the data to send, TOKEN is a unique identifier."
(funcall backend-header) (funcall backend-header)
backend-header))))) backend-header)))))
(append (append
(list "--location" "--silent" "--compressed" "--disable" gptel-curl--common-args
(format "-X%s" "POST") (list (format "-w(%s . %%{size_header})" token)
(format "-w(%s . %%{size_header})" token)
(format "-m%s" 300)
"-D-"
(format "-d%s" data)) (format "-d%s" data))
(when (not (string-empty-p gptel-proxy)) (when (not (string-empty-p gptel-proxy))
(list "--proxy" gptel-proxy (list "--proxy" gptel-proxy