Compare commits

..

5 commits

2 changed files with 12 additions and 3 deletions

View file

@ -306,6 +306,14 @@
auto-mode-alist)) auto-mode-alist))
) )
(defun list-ollama-models ()
"Query the local Ollama server for the list of installed models"
(condition-case error-var
(mapcar #'intern (mapcar #'car (mapcar #'split-string (cdr (process-lines "podllama" "list")))))
(error
(message "Failed to list local models: %s" error-var)
())))
(use-package gptel (use-package gptel
:hook :hook
; keep-sorted start ; keep-sorted start
@ -318,6 +326,7 @@
; keep-sorted start ; keep-sorted start
(gptel-backend (gptel-get-backend "Ollama")) (gptel-backend (gptel-get-backend "Ollama"))
(gptel-default-mode 'org-mode) (gptel-default-mode 'org-mode)
(gptel-expert-commands t)
(gptel-highlight-methods '(face margin)) (gptel-highlight-methods '(face margin))
(gptel-model 'llama3.2:latest) (gptel-model 'llama3.2:latest)
; keep-sorted end ; keep-sorted end
@ -328,7 +337,7 @@
) )
(gptel-make-ollama "Ollama" (gptel-make-ollama "Ollama"
:stream t :stream t
:models '(llama3.2:latest) :models (list-ollama-models)
) )
) )

View file

@ -5,5 +5,5 @@ IFS=$'\n\t'
mkdir --parents ~/.local/share/ollama/ mkdir --parents ~/.local/share/ollama/
pod_id=$(podman run --detach --rm --volume ~/.local/share/ollama/:/root/.ollama ollama:latest) pod_id=$(podman run --detach --rm --volume ~/.local/share/ollama/:/root/.ollama ollama:latest)
podman exec --interactive --tty "${pod_id}" ollama pull "${1}" podman exec --interactive --tty "${pod_id}" ollama "$@"
podman kill "${pod_id}" podman kill "${pod_id}" > /dev/null