(defun my/gptel-windows-on-frame ()
    "Return all windows on frame that aren't gptel chat buffers."
    (delq (and-let* ((current-buf (window-buffer (selected-window)))
                     ((buffer-local-value 'gptel-mode current-buf)))
            (selected-window))
          (window-list)))

  (gptel-make-preset 'visible-buffers
    :description "Include the full text of all buffers visible in the frame."
    :context
    '(:eval (mapcar #'window-buffer (my/gptel-windows-on-frame))))

  (gptel-make-preset 'visible-text
    :description "Include visible text from all windows in the frame."
    :context
    '(:eval (mapcar (lambda (win) ;; Create (<buffer> :bounds ((start . end)))
                      `(,(window-buffer win)
                        :bounds ((,(window-start win) . ,(window-end win)))))
                    (my/gptel-windows-on-frame))))