[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/llm 9c07e22659 33/71: Kill the response buffer when the
From: |
ELPA Syncer |
Subject: |
[elpa] externals/llm 9c07e22659 33/71: Kill the response buffer when the request completed |
Date: |
Fri, 17 May 2024 00:58:46 -0400 (EDT) |
branch: externals/llm
commit 9c07e2265949ffcbc16a83459189c99f42b8aa3e
Author: Roman Scherer <roman@burningswell.com>
Commit: Roman Scherer <roman@burningswell.com>
Kill the response buffer when the request completed
---
plz-media-type.el | 38 ++++++++++++++++++++++++--------------
1 file changed, 24 insertions(+), 14 deletions(-)
diff --git a/plz-media-type.el b/plz-media-type.el
index a273097e80..23008e49c7 100644
--- a/plz-media-type.el
+++ b/plz-media-type.el
@@ -490,43 +490,53 @@ not.
;; FIXME(v0.8): Remove the note about error changes from the docstring.
;; FIXME(v0.8): Update error signals in docstring.
(declare (indent defun))
- (ignore as) ;; TODO: Handle as?
(if-let (media-types (pcase as
(`(media-types ,media-types)
media-types)))
(condition-case error
- (let* ((plz-curl-default-args (cons "--no-buffer"
plz-curl-default-args))
+ (let* ((buffer)
+ (plz-curl-default-args (cons "--no-buffer"
plz-curl-default-args))
(result (plz method url
:as 'buffer
:body body
:body-type body-type
:connect-timeout connect-timeout
:decode decode
- :else (when (functionp else)
- (lambda (error)
+ :else (lambda (error)
+ (setq buffer (current-buffer))
+ (when (or (functionp else) (symbolp else))
(funcall else (plz-media-type-else
plz-media-type--current
error))))
- :finally (when (functionp finally)
- (lambda () (funcall finally)))
+ :finally (lambda ()
+ (unwind-protect
+ (when (functionp finally)
+ (funcall finally))
+ (when (buffer-live-p buffer)
+ (kill-buffer buffer))))
:headers headers
:noquery noquery
:process-filter (lambda (process chunk)
(plz-media-type-process-filter
process media-types chunk))
:timeout timeout
- :then (cond
- ((symbolp then) then)
- ((functionp then)
+ :then (if (symbolp then)
+ then
(lambda (_)
- (funcall then (plz-media-type-then
- plz-media-type--current
-
plz-media-type--response))))))))
+ (setq buffer (current-buffer))
+ (when (or (functionp then) (symbolp then))
+ (funcall then (plz-media-type-then
+ plz-media-type--current
+
plz-media-type--response))))))))
(cond ((bufferp result)
- (with-current-buffer result
- (plz-media-type-then plz-media-type--current
plz-media-type--response)))
+ (unwind-protect
+ (with-current-buffer result
+ (plz-media-type-then plz-media-type--current
plz-media-type--response))
+ (when (buffer-live-p result)
+ (kill-buffer result))))
((processp result)
result)
(t (user-error "Unexpected response: %s" result))))
+ ;; TODO: How to kill the buffer for sync requests that raise an error?
(plz-error (plz-media-type--handle-sync-error error media-types)))
(apply #'plz (append (list method url) rest))))
- [elpa] externals/llm cdbb41528c 18/71: Fix issue advancing the process buffer, (continued)
- [elpa] externals/llm cdbb41528c 18/71: Fix issue advancing the process buffer, ELPA Syncer, 2024/05/17
- [elpa] externals/llm 3441784ae2 19/71: Fix error handling., ELPA Syncer, 2024/05/17
- [elpa] externals/llm 6f9c604e58 20/71: Decode body and chunks using a coding system, ELPA Syncer, 2024/05/17
- [elpa] externals/llm 62495de57f 21/71: Don't decode error response twice, ELPA Syncer, 2024/05/17
- [elpa] externals/llm 03afb1d795 23/71: Use symbols for event types & improve timeout handling, ELPA Syncer, 2024/05/17
- [elpa] externals/llm e07c84b81b 24/71: Improve Curl/HTTP error handling, ELPA Syncer, 2024/05/17
- [elpa] externals/llm 069bd193ef 26/71: Adding Gemini & Vertex streaming using plz, ELPA Syncer, 2024/05/17
- [elpa] externals/llm 99814b533d 28/71: Changes to get at least some of Gemini / Vertex working, ELPA Syncer, 2024/05/17
- [elpa] externals/llm 7919563997 30/71: Merge pull request #31 from r0man/plz, ELPA Syncer, 2024/05/17
- [elpa] externals/llm 40909718cc 31/71: Fix function calling for Gemini & Vertex, and streaming for Gemini, ELPA Syncer, 2024/05/17
- [elpa] externals/llm 9c07e22659 33/71: Kill the response buffer when the request completed,
ELPA Syncer <=
- [elpa] externals/llm a61eb88c53 34/71: Merge pull request #33 from r0man/plz, ELPA Syncer, 2024/05/17
- [elpa] externals/llm fa6c445271 35/71: Fix issue with not handline the plz response correctly for streaming, ELPA Syncer, 2024/05/17
- [elpa] externals/llm f42e00265f 38/71: Add more documentation, ELPA Syncer, 2024/05/17
- [elpa] externals/llm 2426f827d7 39/71: Add process filter error handling, ELPA Syncer, 2024/05/17
- [elpa] externals/llm ffbaa5e683 40/71: Restore error callbacks, ELPA Syncer, 2024/05/17
- [elpa] externals/llm f91d965490 42/71: Add a clause to handle process filter errors, ELPA Syncer, 2024/05/17
- [elpa] externals/llm 609c8a6834 48/71: Fix error message handling, ELPA Syncer, 2024/05/17
- [elpa] externals/llm f409841da3 49/71: Add ability to cancel processes, which is what plz returns, ELPA Syncer, 2024/05/17
- [elpa] externals/llm 1a40b6d656 51/71: Really set reponse body to nil, ELPA Syncer, 2024/05/17
- [elpa] externals/llm c10187a07a 53/71: Set llm-request-plz-timeout to nil, ELPA Syncer, 2024/05/17