When prompting about a whole buffer, don't put whole buffer in chat

This commit is contained in:
Jeremy Dormitzer 2024-06-27 21:49:16 -05:00
parent 78bc060018
commit c140740a32

View File

@ -208,6 +208,7 @@ it has been inserted into the chat buffer."
(defun llama-chat-follow-link ()
(interactive)
(cond
((button-at (point)) (push-button (point)))
((markdown-link-p) (markdown-follow-link-at-point))))
(defun llama-chat-context-action ()
@ -305,7 +306,7 @@ NAME defaults to `llama-chat-default-name'."
(if current-prefix-arg
(read-string "Chat buffer: ")
llama-chat-default-name)))
(let ((input (format "%s\n%s" (buffer-substring-no-properties start end) prompt)))
(let ((input (format "\n%s\n\n%s" (buffer-substring-no-properties start end) prompt)))
(llama-send-string-to-chat
(or name llama-chat-default-name)
input)
@ -320,10 +321,16 @@ NAME defaults to `llama-chat-default-name'."
(if current-prefix-arg
(read-string "Chat buffer: ")
llama-chat-default-name)))
(let ((input (format "%s\n%s" (buffer-substring-no-properties (point-min) (point-max)) prompt)))
(let* ((input (format "%s\n\n%s" (buffer-substring-no-properties (point-min) (point-max)) prompt))
(buf (current-buffer))
(button (buttonize
(format "<Buffer: %s>" (current-buffer))
(lambda (_)
(pop-to-buffer buf)))))
(llama-send-string-to-chat
(or name llama-chat-default-name)
input)
input
:user-visible-string (format "%s\n\n%s" button prompt))
(display-buffer (or name llama-chat-default-name))))
(defun llama-replace-in-region (start end prompt)