Skip to content

Commit f36fb33

Browse files
committed
Insert newlines after streaming tool results
1 parent 118431e commit f36fb33

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

gptel-curl.el

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -266,6 +266,9 @@ Optional RAW disables text properties and transformation."
266266
(set-marker-insertion-type tracking-marker t)
267267
(plist-put info :tracking-marker tracking-marker))
268268
(goto-char tracking-marker)
269+
(when (plist-get info :last-was-tool-result)
270+
(insert gptel-response-separator)
271+
(plist-put info :last-was-tool-result nil))
269272
(unless raw
270273
(when transformer
271274
(setq response (funcall transformer response)))
@@ -280,7 +283,8 @@ Optional RAW disables text properties and transformation."
280283
(`(tool-call . ,tool-calls)
281284
(gptel--display-tool-calls tool-calls info))
282285
(`(tool-result . ,tool-results)
283-
(gptel--display-tool-results tool-results info))))
286+
(gptel--display-tool-results tool-results info)
287+
(plist-put info :last-was-tool-result t))))
284288

285289
(defun gptel-curl--stream-filter (process output)
286290
(let* ((fsm (alist-get process gptel--request-alist))

0 commit comments

Comments
 (0)