Function: gptel--reject-tool-calls

gptel--reject-tool-calls is an interactive and natively compiled function defined in gptel.el.

Signature

(gptel--reject-tool-calls &optional TOOL-CALLS OV)

Documentation

Cancel pending tool-calls.

OV is the tool call dispatch overlay.

Key Bindings

gptel-tool-call-actions-map C-c C-k

Source Code

;; Defined in /nix/store/q3r7g81pvghw7a523kjk2k2zih3pfk8z-emacs-packages-deps/share/emacs/site-lisp/elpa/gptel-20261002.545/gptel.el
(defun gptel--reject-tool-calls (&optional _tool-calls ov)
  "Cancel pending tool-calls.

OV is the tool call dispatch overlay."
  (interactive (pcase-let ((`(,resp . ,o) (get-char-property-and-overlay
                                           (point) 'gptel-tool)))
                 (list resp o)))
  (gptel--update-status " Tools cancelled" 'error)
  (message (substitute-command-keys
            "Tool calls canceled.  \\[gptel-menu] to continue them!"))
  (when (and (overlayp ov) (overlay-buffer ov))
    (with-current-buffer (overlay-buffer ov)
      (when-let* ((preview-handles (overlay-get ov 'previews)))
        (dolist (func-to-handle preview-handles)
          (when (car func-to-handle) (apply func-to-handle))))
      (dolist (prompt-ov (overlay-get ov 'prompt))
        (when-let* (((overlay-buffer prompt-ov))
                    (inhibit-read-only t))
          (delete-region (overlay-start prompt-ov)
                         (overlay-end prompt-ov)))))
    (delete-overlay ov)))