Skip to content

Commit

Permalink
gptel-curl: Adjust response beginning position
Browse files Browse the repository at this point in the history
gptel-curl.el (gptel-curl--stream-cleanup,
gptel-curl--stream-insert-response): Don't consider
`gptel-response-prefix-string` part of the response for the
purpose of running `gptel-post-response-functions`.
  • Loading branch information
karthink committed Mar 6, 2024
1 parent eb088f2 commit 0d6264f
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions gptel-curl.el
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ PROCESS and _STATUS are process parameters."
(progn
;; Finish handling response
(with-current-buffer (marker-buffer start-marker)
(setq response-beg (+ start-marker 2)
(setq response-beg (marker-position start-marker)
response-end (marker-position tracking-marker))
(pulse-momentary-highlight-region response-beg tracking-marker)
(when gptel-mode (save-excursion (goto-char tracking-marker)
Expand Down Expand Up @@ -262,7 +262,8 @@ See `gptel--url-get-response' for details."
(insert "\n\n")
(when gptel-mode
;; Put prefix before AI response.
(insert (gptel-response-prefix-string))))
(insert (gptel-response-prefix-string)))
(move-marker start-marker (point)))
(setq tracking-marker (set-marker (make-marker) (point)))
(set-marker-insertion-type tracking-marker t)
(plist-put info :tracking-marker tracking-marker))
Expand Down

0 comments on commit 0d6264f

Please sign in to comment.