Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dedicated buffer like gptel-inspect-query, but just to edit the response at point with the same major mode #573

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

axelknock
Copy link
Contributor

I quite like the ability to edit LLM responses since it's a powerful method for guidance. Currently it's a bit finnicky to edit responses, as you have to pay attention to the boundaries of the response, and then use a self-defined function to mark the region of your edits as part of the response with the text property.

This interactive function is just designed to make that easier. It's also possible to define a wrapper for editing specific responses:

(defun my/gptel-edit-last-response ()
  "Use `gptel-edit-response' to edit the last response before point."
  (interactive)
  (gptel-edit-response
   (progn (gptel-beginning-of-response nil nil current-prefix-arg)
          (forward-char (+ 1 (length (gptel-response-prefix-string)))))))

(inconsistent result when I don't move point forward into response by 1 char)

@karthink
Copy link
Owner

Have you seen #343?

@axelknock
Copy link
Contributor Author

Have you seen #343?

Yes. I assume you are referring to it to point out that there is ongoing discussion on how best to track responses in buffers, and gptel-edit-response does not necessarily fit in with whatever might be used in the future. I would be happy for there to be a better in-buffer solution and have this function deprecated in the future, but right now I see it as the best solution to edit responses in a robust manner, which I find necessary.

gptel-edit-response is also technically independent of any further changes to the way in which responses are tracked, since it just relies on finding gptel--get-bounds which will still be functional even if its internals change to using overlays or something else. But of course it would be redundant if you could reliably edit the response in the current buffer.

I also noticed that gptel--inspect-query was changed to allow writing, which is another way to achieve an edited response, but I confess I do not understand in what case you would want to send a version of the current buffer that has been altered without committing those changes to the original buffer.

I've also seen #546 and commented on #565 which relate to this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants