Automatically update the list of Ollama models

This commit is contained in:
Ohad Livne 2025-12-03 18:24:25 +02:00
parent 7900661c82
commit 1b7fb23a2e
Signed by: libohad-dev
GPG key ID: 34FDC68B51191A4D
2 changed files with 9 additions and 5 deletions

View file

@ -327,6 +327,12 @@
(seq-find (lambda (x) (eq (car x) model)) library model)) (seq-find (lambda (x) (eq (car x) model)) library model))
available)) available))
(defun generate-ollama-declaration ()
(gptel-make-ollama "Ollama"
:host "ollama:11434"
:stream t
:models (enrich-ollama-models (list-ollama-models) gptel--local-models)))
(use-package gptel (use-package gptel
:hook :hook
;; keep-sorted start ;; keep-sorted start
@ -350,11 +356,7 @@
:stream t :stream t
:key 'gptel-api-key-from-auth-source :key 'gptel-api-key-from-auth-source
) )
(gptel-make-ollama "Ollama" (generate-ollama-declaration)
:host "ollama:11434"
:stream t
:models (enrich-ollama-models (list-ollama-models) gptel--local-models)
)
) )
(use-package power-mode) (use-package power-mode)

View file

@ -53,3 +53,5 @@ fi
pod_id=$("${PODMAN[@]}" run --detach --rm "${MOUNTS[@]}" "${NETWORK[@]}" ollama:latest) pod_id=$("${PODMAN[@]}" run --detach --rm "${MOUNTS[@]}" "${NETWORK[@]}" ollama:latest)
"${PODMAN[@]}" exec --interactive --tty "${pod_id}" ollama "$@" "${PODMAN[@]}" exec --interactive --tty "${pod_id}" ollama "$@"
"${PODMAN[@]}" kill "${pod_id}" > /dev/null "${PODMAN[@]}" kill "${pod_id}" > /dev/null
emacsclient --eval "(generate-ollama-declaration)"