karthink / gptel

A simple LLM client for Emacs
GNU General Public License v3.0
1.04k stars 111 forks source link

Adding hook to `gptel-post-response-functions` results in error in process sentinel #248

Closed daedsidog closed 3 months ago

daedsidog commented 3 months ago

(add-hook 'gptel-post-response-functions (lambda () (message "hello")))

Then send a message in gptel, this results in:

Send your query with C-c RET!
Querying ChatGPT...
error in process sentinel: run-hook-with-args: Wrong number of arguments: ((t) nil (message "hello")), 2

I'm on the latest commit. This also happens if I use gptel-post-response-hook.

karthink commented 3 months ago

Please see the docstring for gptel-post-response-functions. It's an abnormal hook where each function is passed the bounds of the response.

daedsidog commented 3 months ago

Thanks, that was my fault.

karthink commented 3 months ago

Thanks, that was my fault.

No worries, the API changed at some point because it was much more useful to be able to access the response bounds for further processing.

daedsidog commented 3 months ago

Yep, I did it manually so far. Great change.