branch: elpa/gptel
commit 9dcee1a1787deaed5208d82f5426e2fdbf998fe8
Author: Karthik Chikmagalur <[email protected]>
Commit: Karthik Chikmagalur <[email protected]>

    gptel-request: No newlines when indicating tool results
    
    * gptel.el (gptel--display-tool-results): Remove newlines from the
    truncated tool call used to adorn the src block headers of tool
    result blocks.  This was causing the parsing to fail.
    
    * gptel-request.el (gptel-context): Fix doc.
---
 gptel-request.el | 4 ++--
 gptel.el         | 8 +++++---
 2 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/gptel-request.el b/gptel-request.el
index 12380d3e013..0aa9ee4830f 100644
--- a/gptel-request.el
+++ b/gptel-request.el
@@ -723,8 +723,8 @@ For files, spec can include buffer spans and line number 
ranges, as well as
 the MIME type of the file:
 
   (\"/path/to/file\" :bounds ((start1 . end1) (start2 . end2) ...)
-                     :lines  ((from1 . to1) (from2 . end2) ...)
-                     :mime \"image/png\")
+                   :lines  ((from1 . to1) (from2 . end2) ...)
+                   :mime \"image/png\")
 
 gptel tries to guess file MIME types, but is not always successful, so
 it is recommended to provide it with non-text files.
diff --git a/gptel.el b/gptel.el
index b080d97c39c..8b2bf4a0fb5 100644
--- a/gptel.el
+++ b/gptel.el
@@ -1723,9 +1723,11 @@ for tool call results.  INFO contains the state of the 
request."
                     (display-call (format "(%s %s)" name
                                           (string-trim (prin1-to-string args) 
"(" ")")))
                     (call (prin1-to-string `(:name ,name :args ,args)))
-                    (truncated-call (truncate-string-to-width
-                                     display-call
-                                     (floor (* (window-width) 0.6)) 0 nil " 
...)")))
+                    (truncated-call
+                     (string-replace "\n" " "
+                                     (truncate-string-to-width
+                                      display-call
+                                      (floor (* (window-width) 0.6)) 0 nil " 
...)"))))
                (if (derived-mode-p 'org-mode)
                    (concat
                     separator

Reply via email to