gptel: Fix spacing issues in response

This commit is contained in:
Karthik Chikmagalur 2023-03-05 18:56:41 -08:00
parent 86bf0c9f74
commit a5fe30312f

View file

@ -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)