gptel, gptel-curl: Address checkdoc warnings
* gptel.el (gptel--url-parse-response, gptel-max-tokens, gptel-use-header-line): Address checkdoc warnings. * gptel-curl.el (gptel-curl--parse-response, gptel-abort): Address checkdoc warnings. * gptel-gemini (gptel-make-gemini): Address checkdoc warnings.
This commit is contained in:
parent
7271d0e408
commit
4d01dddf7d
3 changed files with 35 additions and 34 deletions
|
@ -139,7 +139,7 @@ the response is inserted into the current buffer after point."
|
||||||
(set-process-sentinel process #'gptel-curl--sentinel)))))
|
(set-process-sentinel process #'gptel-curl--sentinel)))))
|
||||||
|
|
||||||
(defun gptel-abort (buf)
|
(defun gptel-abort (buf)
|
||||||
"Stop any active gptel process associated with the current buffer."
|
"Stop any active gptel process associated with buffer BUF."
|
||||||
(interactive (list (current-buffer)))
|
(interactive (list (current-buffer)))
|
||||||
(unless gptel-use-curl
|
(unless gptel-use-curl
|
||||||
(user-error "Cannot stop a `url-retrieve' request!"))
|
(user-error "Cannot stop a `url-retrieve' request!"))
|
||||||
|
@ -295,9 +295,9 @@ See `gptel--url-get-response' for details."
|
||||||
(when-let ((http-msg (plist-get proc-info :status))
|
(when-let ((http-msg (plist-get proc-info :status))
|
||||||
(http-status (plist-get proc-info :http-status)))
|
(http-status (plist-get proc-info :http-status)))
|
||||||
;; Find data chunk(s) and run callback
|
;; Find data chunk(s) and run callback
|
||||||
(when-let ((_ (equal http-status "200"))
|
(when-let (((equal http-status "200"))
|
||||||
(response (funcall (plist-get proc-info :parser) nil proc-info))
|
(response (funcall (plist-get proc-info :parser) nil proc-info))
|
||||||
(_ (not (equal response ""))))
|
((not (equal response ""))))
|
||||||
(funcall (or (plist-get proc-info :callback)
|
(funcall (or (plist-get proc-info :callback)
|
||||||
#'gptel-curl--stream-insert-response)
|
#'gptel-curl--stream-insert-response)
|
||||||
response proc-info))))))
|
response proc-info))))))
|
||||||
|
@ -337,8 +337,7 @@ PROCESS and _STATUS are process parameters."
|
||||||
(defun gptel-curl--parse-response (proc-info)
|
(defun gptel-curl--parse-response (proc-info)
|
||||||
"Parse the buffer BUF with curl's response.
|
"Parse the buffer BUF with curl's response.
|
||||||
|
|
||||||
TOKEN is used to disambiguate multiple requests in a single
|
PROC-INFO is a plist with contextual information."
|
||||||
buffer."
|
|
||||||
(let ((token (plist-get proc-info :token))
|
(let ((token (plist-get proc-info :token))
|
||||||
(parser (plist-get proc-info :parser)))
|
(parser (plist-get proc-info :parser)))
|
||||||
(goto-char (point-max))
|
(goto-char (point-max))
|
||||||
|
|
|
@ -115,7 +115,7 @@ HOST (optional) is the API host, defaults to
|
||||||
MODELS is a list of available model names. Currently only
|
MODELS is a list of available model names. Currently only
|
||||||
\"gemini-pro\" is available.
|
\"gemini-pro\" is available.
|
||||||
|
|
||||||
STREAM is a boolean to toggle streaming responses, defaults to
|
STREAM is a boolean to enable streaming responses, defaults to
|
||||||
false.
|
false.
|
||||||
|
|
||||||
PROTOCOL (optional) specifies the protocol, \"https\" by default.
|
PROTOCOL (optional) specifies the protocol, \"https\" by default.
|
||||||
|
|
16
gptel.el
16
gptel.el
|
@ -29,7 +29,8 @@
|
||||||
|
|
||||||
;; gptel is a simple Large Language Model chat client, with support for multiple models/backends.
|
;; gptel is a simple Large Language Model chat client, with support for multiple models/backends.
|
||||||
;;
|
;;
|
||||||
;; gptel supports ChatGPT, Azure, and local models using Ollama and GPT4All.
|
;; gptel supports ChatGPT, Azure, Gemini and local models using Ollama and
|
||||||
|
;; GPT4All.
|
||||||
;;
|
;;
|
||||||
;; Features:
|
;; Features:
|
||||||
;; - It’s async and fast, streams responses.
|
;; - It’s async and fast, streams responses.
|
||||||
|
@ -44,8 +45,8 @@
|
||||||
;; Requirements for ChatGPT, Azure or Gemini:
|
;; Requirements for ChatGPT, Azure or Gemini:
|
||||||
;;
|
;;
|
||||||
;; - You need an appropriate API key. Set the variable `gptel-api-key' to the
|
;; - You need an appropriate API key. Set the variable `gptel-api-key' to the
|
||||||
;; key or to a function of no arguments that returns the key. (It tries to use
|
;; key or to a function of no arguments that returns the key. (It tries to
|
||||||
;; `auth-source' by default)
|
;; use `auth-source' by default)
|
||||||
;;
|
;;
|
||||||
;; - For Azure: define a gptel-backend with `gptel-make-azure', which see.
|
;; - For Azure: define a gptel-backend with `gptel-make-azure', which see.
|
||||||
;; - For Gemini: define a gptel-backend with `gptel-make-gemini', which see.
|
;; - For Gemini: define a gptel-backend with `gptel-make-gemini', which see.
|
||||||
|
@ -197,8 +198,8 @@ such as filling paragraphs, adding annotations or recording
|
||||||
information in the response like links.
|
information in the response like links.
|
||||||
|
|
||||||
Each function in this hook receives two arguments, the response
|
Each function in this hook receives two arguments, the response
|
||||||
string to transform and the ChatGPT interaction buffer. It should
|
string to transform and the ChatGPT interaction buffer. It
|
||||||
return the transformed string."
|
should return the transformed string."
|
||||||
:group 'gptel
|
:group 'gptel
|
||||||
:type 'hook)
|
:type 'hook)
|
||||||
|
|
||||||
|
@ -276,7 +277,8 @@ is only inserted in dedicated gptel buffers before the AI's response."
|
||||||
:type '(alist :key-type symbol :value-type string))
|
:type '(alist :key-type symbol :value-type string))
|
||||||
|
|
||||||
(defcustom gptel-use-header-line t
|
(defcustom gptel-use-header-line t
|
||||||
"Whether gptel-mode should use the header-line for status information.
|
"Whether `gptel-mode' should use header-line for status
|
||||||
|
information.
|
||||||
|
|
||||||
When set to nil, use the mode line for (minimal) status
|
When set to nil, use the mode line for (minimal) status
|
||||||
information and the echo area for messages."
|
information and the echo area for messages."
|
||||||
|
@ -1008,7 +1010,7 @@ PROC-INFO is a plist with process information and other context.
|
||||||
See `gptel-curl--get-response' for its contents.")
|
See `gptel-curl--get-response' for its contents.")
|
||||||
|
|
||||||
(defun gptel--url-parse-response (backend response-buffer)
|
(defun gptel--url-parse-response (backend response-buffer)
|
||||||
"Parse response in RESPONSE-BUFFER."
|
"Parse response from BACKEND in RESPONSE-BUFFER."
|
||||||
(when (buffer-live-p response-buffer)
|
(when (buffer-live-p response-buffer)
|
||||||
(when gptel--debug
|
(when gptel--debug
|
||||||
(with-current-buffer response-buffer
|
(with-current-buffer response-buffer
|
||||||
|
|
Loading…
Add table
Reference in a new issue