From a5fe30312fe6826a4994381c0f0e24360137dd93 Mon Sep 17 00:00:00 2001 From: Karthik Chikmagalur Date: Sun, 5 Mar 2023 18:56:41 -0800 Subject: [PATCH] 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 3fbec9c..e59e954 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)