branch: elpa/gptel
commit 0a2fcb952899900e31dab9faf48cc8974fbd0ba9
Author: Karthik Chikmagalur <[email protected]>
Commit: Karthik Chikmagalur <[email protected]>
gptel-curl: Handle end of reasoning stream in other buffer
* gptel-curl.el (gptel-curl--stream-insert-response): When a
reasoning block stream ends, the callback receives a value of t
for the reasoning text. Handle this case when piping the
reasoning output to another buffer.
---
gptel-curl.el | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/gptel-curl.el b/gptel-curl.el
index 76b6c9475f..734aa770bb 100644
--- a/gptel-curl.el
+++ b/gptel-curl.el
@@ -273,10 +273,11 @@ Optional RAW disables text properties and transformation."
0 (length text) '(gptel ignore front-sticky (gptel)) text))
(gptel-curl--stream-insert-response text info t))
((pred stringp)
- (with-current-buffer (get-buffer-create
- (plist-get info :include-reasoning))
- (save-excursion (goto-char (point-max))
- (insert text))))))
+ (unless (eq text t)
+ (with-current-buffer (get-buffer-create
+ (plist-get info :include-reasoning))
+ (save-excursion (goto-char (point-max))
+ (insert text)))))))
(`(tool-call . ,tool-calls)
(gptel--display-tool-calls tool-calls info))
(`(tool-result . ,tool-results)