branch: elpa/gptel commit 40f6950e80676bb92a3a7e07656d87578439fbbe Author: Karthik Chikmagalur <karthikchikmaga...@gmail.com> Commit: Karthik Chikmagalur <karthikchikmaga...@gmail.com>
gptel-transient: Fix two-part prompt handling bug * gptel-transient.el (gptel--suffix-send): Fix bug introduced by 76193339, where a two part prompt (region + instructions) was not being collapsed before being sent. This is a temporary fix while I figure out how to handle this case more elegantly. --- gptel-transient.el | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/gptel-transient.el b/gptel-transient.el index 4c7520c932f..e05ff7aaf77 100644 --- a/gptel-transient.el +++ b/gptel-transient.el @@ -1642,8 +1642,6 @@ This sets the variable `gptel-include-tool-results', which see." (cdr reduced-prompt)) (concat "``` " (gptel--strip-mode-suffix major-mode) "\n" (or (cdr-safe reduced-prompt) reduced-prompt) "\n```" ))))) - ;; If the prompt is a cons (region-text . instructions), collapse it - (when (consp prompt) (setq prompt (concat (car prompt) "\n\n" (cdr prompt)))) (cond ((buffer-live-p gptel-buffer) ;; Insert into existing gptel session @@ -1684,6 +1682,10 @@ This sets the variable `gptel-include-tool-results', which see." (setq buffer (get-buffer-create gptel-buffer-name)) (with-current-buffer buffer (setq position (point))))) + ;; MAYBE: This is no a good way to handle two-part (region + instruction) prompts + ;; If the prompt is a cons (region-text . instructions), collapse it + (when (consp prompt) (setq prompt (concat (car prompt) "\n\n" (cdr prompt)))) + (prog1 (gptel-request prompt :buffer (or buffer (current-buffer)) :position position