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

    gptel: Fix spacing issues in response
---
 gptel.el | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/gptel.el b/gptel.el
index 3fbec9ca8c..e59e954431 100644
--- a/gptel.el
+++ b/gptel.el
@@ -191,8 +191,10 @@ Ask for API-KEY if `gptel-api-key' is unset."
       (if-let* ((status (buffer-substring (line-beginning-position) 
(line-end-position)))
                 ((string-match "200 OK" status))
                 (response (progn (forward-paragraph)
-                                 (json-read))))
-          (map-nested-elt response '(:choices 0 :message :content))
+                                 (json-read)))
+                (content (map-nested-elt
+                          response '(:choices 0 :message :content))))
+          (string-trim content)
         (user-error "Chat failed with status: %S" status)))))
 
 (defvar gptel-playback-response t)

Reply via email to