1
0
Fork 0

Do some error handling whenever curl fails

This commit is contained in:
Bram Schoenmakers 2023-12-24 08:53:59 +01:00
parent 8df4b24238
commit 0105a07695
Signed by: bram
GPG key ID: 0CCD19DFDC63258F

View file

@ -151,7 +151,12 @@ PROMPT is used to fill in the POST part of the request."
(let ((command (kagi--build-curl-command prompt)))
(if kagi-debug
kagi--canned-response
(shell-command-to-string command))))
(with-temp-buffer
(let ((return (call-process-shell-command command nil t)))
(if (eql return 0)
(buffer-string)
(error "Call to FastGPT API returned with status %s" return)))))))
(defun kagi--process-prompt (prompt)
"Submit a PROMPT to FastGPT and process the API response.