emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/gptel bb8b37d8c0 100/273: gptel, gptel-curl: Fix byte-comp


From: ELPA Syncer
Subject: [nongnu] elpa/gptel bb8b37d8c0 100/273: gptel, gptel-curl: Fix byte-compile warnings
Date: Wed, 1 May 2024 10:01:55 -0400 (EDT)

branch: elpa/gptel
commit bb8b37d8c09ff0ed07d98bf5269fe49229679168
Author: Karthik Chikmagalur <karthikchikmagalur@gmail.com>
Commit: Karthik Chikmagalur <karthikchikmagalur@gmail.com>

    gptel, gptel-curl: Fix byte-compile warnings
    
    gptel.el (gptel--request-data): Also use :json-false to encode nil in the 
http
    request.
---
 gptel-curl.el | 16 +++++++---------
 gptel.el      |  5 +++--
 2 files changed, 10 insertions(+), 11 deletions(-)

diff --git a/gptel-curl.el b/gptel-curl.el
index 0d6733f573..6914c60fac 100644
--- a/gptel-curl.el
+++ b/gptel-curl.el
@@ -124,10 +124,10 @@ the response is inserted into the current buffer after 
point."
     (message "No gptel request associated with buffer %S" (buffer-name buf))))
 
 ;; TODO: Separate user-messaging from this function
-(defun gptel-curl--stream-cleanup (process status)
+(defun gptel-curl--stream-cleanup (process _status)
   "Process sentinel for GPTel curl requests.
 
-PROCESS and STATUS are process parameters."
+PROCESS and _STATUS are process parameters."
   (let ((proc-buf (process-buffer process)))
     (when gptel--debug
       (with-current-buffer proc-buf
@@ -181,8 +181,7 @@ PROCESS and STATUS are process parameters."
 
 INFO is a mutable plist containing information relevant to this buffer.
 See `gptel--url-get-response' for details."
-  (let ((status-str  (plist-get response :status))
-        (start-marker (plist-get info :position))
+  (let ((start-marker (plist-get info :position))
         (tracking-marker (plist-get info :tracking-marker))
         (transformer (plist-get info :transformer)))
     (when response
@@ -205,8 +204,7 @@ See `gptel--url-get-response' for details."
             (insert response))))))
 
 (defun gptel-curl--stream-filter (process output)
-  (let* ((content-strs)
-         (proc-info (alist-get process gptel-curl--process-alist)))
+  (let* ((proc-info (alist-get process gptel-curl--process-alist)))
     (with-current-buffer (process-buffer process)
       ;; Insert output
       (save-excursion
@@ -248,7 +246,7 @@ See `gptel--url-get-response' for details."
           (funcall (or (plist-get proc-info :callback)
                        #'gptel-curl--stream-insert-response)
                    (let* ((json-object-type 'plist)
-                          (response) (content-str))
+                          (content-strs))
                      (condition-case nil
                          (while (re-search-forward "^data:" nil t)
                            (save-match-data
@@ -263,10 +261,10 @@ See `gptel--url-get-response' for details."
                      (apply #'concat (nreverse content-strs)))
                    proc-info))))))
 
-(defun gptel-curl--sentinel (process status)
+(defun gptel-curl--sentinel (process _status)
   "Process sentinel for GPTel curl requests.
 
-PROCESS and STATUS are process parameters."
+PROCESS and _STATUS are process parameters."
   (let ((proc-buf (process-buffer process)))
     (when gptel--debug
       (with-current-buffer proc-buf
diff --git a/gptel.el b/gptel.el
index 0406f395af..4ba8dacb55 100644
--- a/gptel.el
+++ b/gptel.el
@@ -67,7 +67,8 @@
 (require 'text-property-search)
 
 (defgroup gptel nil
-  "Interact with ChatGPT from anywhere in Emacs.")
+  "Interact with ChatGPT from anywhere in Emacs."
+  :group 'hypermedia)
 
 (defcustom gptel-host "api.openai.com"
   "The API host queried by gptel."
@@ -517,7 +518,7 @@ there."
   (let ((prompts-plist
          `(:model ,gptel-model
            :messages [,@prompts]
-           :stream ,(and gptel-stream gptel-use-curl))))
+           :stream ,(or (and gptel-stream gptel-use-curl) :json-false))))
     (when gptel-temperature
       (plist-put prompts-plist :temperature (gptel--numberize 
gptel-temperature)))
     (when gptel-max-tokens



reply via email to

[Prev in Thread] Current Thread [Next in Thread]