[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/gptel 199595b0c8 216/273: gptel: Handle status HTTP 100
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/gptel 199595b0c8 216/273: gptel: Handle status HTTP 100 |
Date: |
Wed, 1 May 2024 10:02:26 -0400 (EDT) |
branch: elpa/gptel
commit 199595b0c84e54719d12d940896d9b8704bef1fd
Author: Karthik Chikmagalur <karthikchikmagalur@gmail.com>
Commit: Karthik Chikmagalur <karthikchikmagalur@gmail.com>
gptel: Handle status HTTP 100
gptel.el (gptel--url-parse-response): Handle HTTP 100 followed by
200. Note: this fix is brittle, it will break if 100 is followed
by an error code.
gptel-curl.el (gptel-curl--stream-filter,
gptel-curl--parse-stream): Ditto. Address #194.
---
gptel-curl.el | 10 ++++++----
gptel.el | 4 +++-
2 files changed, 9 insertions(+), 5 deletions(-)
diff --git a/gptel-curl.el b/gptel-curl.el
index 4c4215a831..764835f36e 100644
--- a/gptel-curl.el
+++ b/gptel-curl.el
@@ -201,7 +201,7 @@ PROCESS and _STATUS are process parameters."
(http-status (plist-get info :http-status))
(http-msg (plist-get info :status)))
(when gptel-log-level (gptel-curl--log-response proc-buf info)) ;logging
- (if (equal http-status "200") ;Finish
handling response
+ (if (member http-status '("200" "100")) ;Finish handling response
(with-current-buffer gptel-buffer
(if (not tracking-marker) ;Empty response
(when gptel-mode (gptel--update-status " Empty response"
'success))
@@ -315,7 +315,7 @@ See `gptel--url-get-response' for details."
display-buffer-pop-up-window)
(reusable-frames . visible))))
;; Run pre-response hook
- (when (and (equal (plist-get proc-info :http-status) "200")
+ (when (and (member (plist-get proc-info :http-status) '("200" "100"))
gptel-pre-response-hook)
(with-current-buffer (marker-buffer (plist-get proc-info :position))
(run-hooks 'gptel-pre-response-hook))))
@@ -323,7 +323,8 @@ See `gptel--url-get-response' for details."
(when-let ((http-msg (plist-get proc-info :status))
(http-status (plist-get proc-info :http-status)))
;; Find data chunk(s) and run callback
- (when-let (((equal http-status "200"))
+ ;; FIXME Handle the case where HTTP 100 is followed by HTTP (not 200)
BUG #194
+ (when-let (((member http-status '("200" "100")))
(response (funcall (plist-get proc-info :parser) nil
proc-info))
((not (equal response ""))))
(funcall (or (plist-get proc-info :callback)
@@ -385,7 +386,8 @@ PROC-INFO is a plist with contextual information."
(json-read)
(json-readtable-error 'json-read-error)))))
(cond
- ((equal http-status "200")
+ ;; FIXME Handle the case where HTTP 100 is followed by HTTP (not
200) BUG #194
+ ((member http-status '("200" "100"))
(list (string-trim
(funcall parser nil response proc-info))
http-msg))
diff --git a/gptel.el b/gptel.el
index 2cc360e9b1..cbd5094edd 100644
--- a/gptel.el
+++ b/gptel.el
@@ -1183,7 +1183,9 @@ See `gptel-curl--get-response' for its contents.")
(json-read-from-string json-str)
(json-readtable-error
'json-read-error))))))
(cond
- ((or (= url-http-response-status 200) (string-match-p "200 OK"
http-msg))
+ ;; FIXME Handle the case where HTTP 100 is followed by HTTP (not
200) BUG #194
+ ((or (memq url-http-response-status '(200 100))
+ (string-match-p "\\(?:1\\|2\\)00 OK" http-msg))
(list (string-trim (gptel--parse-response backend response
'(:buffer response-buffer)))
http-msg))
- [nongnu] elpa/gptel 0f161a466b 109/273: gptel: saving and restoring state for Markdown/Text, (continued)
- [nongnu] elpa/gptel 0f161a466b 109/273: gptel: saving and restoring state for Markdown/Text, ELPA Syncer, 2024/05/01
- [nongnu] elpa/gptel 5c3b26aeec 138/273: gptel-curl: Tweak Curl arguments for windows, ELPA Syncer, 2024/05/01
- [nongnu] elpa/gptel 15404f639d 139/273: README: Update instructions for Azure (#147), ELPA Syncer, 2024/05/01
- [nongnu] elpa/gptel ddd69cbbcf 147/273: gptel-curl: Replace Curl timeout with speed-time, ELPA Syncer, 2024/05/01
- [nongnu] elpa/gptel 60cb406567 162/273: gptel: Improve documentation of gptel-send, ELPA Syncer, 2024/05/01
- [nongnu] elpa/gptel 8ec233d79c 174/273: gptel: Name gptel buffer according to backend, ELPA Syncer, 2024/05/01
- [nongnu] elpa/gptel 235134a176 186/273: Bit of feedback when copying reponse to kill ring, ELPA Syncer, 2024/05/01
- [nongnu] elpa/gptel 50fb34ab7c 187/273: Fix compilation warnings, ELPA Syncer, 2024/05/01
- [nongnu] elpa/gptel 10f57605ce 195/273: gptel: Improve Org stream conversion, ELPA Syncer, 2024/05/01
- [nongnu] elpa/gptel 6a385ffc2f 199/273: README: Add FAQ entry for OpenAI quota error (#93), ELPA Syncer, 2024/05/01
- [nongnu] elpa/gptel 199595b0c8 216/273: gptel: Handle status HTTP 100,
ELPA Syncer <=
- [nongnu] elpa/gptel b634f05fe5 218/273: gptel: Tweak markdown to org conversion, ELPA Syncer, 2024/05/01
- [nongnu] elpa/gptel 2487ada4d6 217/273: gptel-anthropic: Handle missing response chunks (trial), ELPA Syncer, 2024/05/01
- [nongnu] elpa/gptel e18ceb1f84 226/273: gptel: Improve logging, ELPA Syncer, 2024/05/01
- [nongnu] elpa/gptel b2985392f4 270/273: gptel: Linting for NonGNU ELPA, ELPA Syncer, 2024/05/01
- [nongnu] elpa/gptel f0b18c5f8b 113/273: gptel-transient: Exit gptel-system-prompt after selection (#96), ELPA Syncer, 2024/05/01
- [nongnu] elpa/gptel 42d53b25e5 041/273: gptel: Handle insufficient quota and other errors, ELPA Syncer, 2024/05/01
- [nongnu] elpa/gptel 18222818dc 070/273: gptel: Add gptel-request, ELPA Syncer, 2024/05/01
- [nongnu] elpa/gptel 36051b15d5 068/273: gptel: Unify error descriptions, ELPA Syncer, 2024/05/01
- [nongnu] elpa/gptel 20af9a8b99 095/273: gptel: curl proxy support (#69), ELPA Syncer, 2024/05/01
- [nongnu] elpa/gptel c29e1cd673 079/273: gptel-transient: Minor formatting changes., ELPA Syncer, 2024/05/01