Skip to content

Instantly share code, notes, and snippets.

@MasWag
Last active February 19, 2024 08:05
Show Gist options
  • Save MasWag/0a7a5eae1b35c8692934b8e7510f8b05 to your computer and use it in GitHub Desktop.
Save MasWag/0a7a5eae1b35c8692934b8e7510f8b05 to your computer and use it in GitHub Desktop.
;; I use Ellama (https://github.com/s-kostyaev/ellama/) to streamline my interactions with LLM. Here's the configuration:
;;
;; Since Ellama relies on ollama (https://ollama.ai/) and its zephyr library (https://ollama.ai/library/zephyr) by default, you need to configure it externally. After downloading ollama, you can obtain zephyr with `ollama pull zephyr`.
(leaf ellama
:ensure t
:require t
:custom
;; I use C-c , as the prefix of ollama
(ellama-keymap-prefix . "C-c ,")
:config
(ellama-setup-keymap)
(defcustom ellama-commit-message-prompt-template "Review the following code changes and make a concise commit message:\n```\n%s\n```"
"Prompt template for `ellama-commit-message'."
:group 'ellama
:type 'string)
(defun ellama-commit-message ()
"Review code in selected region or current buffer."
(interactive)
(let ((text (if (region-active-p)
(buffer-substring-no-properties (region-beginning) (region-end))
(buffer-substring-no-properties (point-min) (point-max)))))
(ellama-instant (format ellama-commit-message-prompt-template text)))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment