Add some utility AI replacement functions

This commit is contained in:
Jeremy Dormitzer 2024-07-02 15:07:57 -04:00
parent 11755d6201
commit 9acc16c9aa

View File

@ -407,5 +407,29 @@ Do not include any additonal notes or commentary outside of the explanation sect
(insert replacement)))))))
(lambda (_ msg) (error "Error calling the LLM: %s" msg)))))
(defun llama-add-comments (start end)
"Add explanatory comments to the code between START and END."
(interactive "r")
(llama-replace-in-region
start
end
"Add concise comments explaining parts of this code that would be otherwise difficult to interpret. Comments belong either on a line by themselves above the code they explain, or inline with the code at the end of the line. Answer with the complete code including the comments. Do not wrap your response in code fences or other markup."))
(defun llama-fill (start end)
"Replace the //fill keyword with the missing logic between START and END."
(interactive "r")
(llama-replace-in-region
start
end
"Replace the keyword //fill in the input with the missing logic. Answer with the complete code including filled-in logic. Do not wrap your response in code fences or other markup."))
(defun llama-rename-symbols (start end)
"Rename code symbols between START and END for clarity and expressiveness."
(interactive "r")
(llama-replace-in-region
start
end
"Rename code symbols (function, variable, class) for clarity and expressiveness. Answer with only the complete code. Do not wrap your response in code fences or other markup."))
(provide 'llama)
;;; llama.el ends here