emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/ellama b224bab33c 2/8: Merge pull request #142 from s-k


From: ELPA Syncer
Subject: [elpa] externals/ellama b224bab33c 2/8: Merge pull request #142 from s-kostyaev/improve-ollama-binary-customization
Date: Wed, 10 Jul 2024 18:58:03 -0400 (EDT)

branch: externals/ellama
commit b224bab33c03ed012a3fc3aae55d123e0107e49d
Merge: d6d38df99d 4a05ba5924
Author: Sergey Kostyaev <s-kostyaev@users.noreply.github.com>
Commit: GitHub <noreply@github.com>

    Merge pull request #142 from s-kostyaev/improve-ollama-binary-customization
    
    Allow ollama-binary to accept the executable's base name
---
 ellama.el | 22 ++++++++++++++--------
 1 file changed, 14 insertions(+), 8 deletions(-)

diff --git a/ellama.el b/ellama.el
index eaffd53c61..22d9f9d1c4 100644
--- a/ellama.el
+++ b/ellama.el
@@ -172,7 +172,7 @@
           (ellama-setup-keymap)))
   :group 'ellama)
 
-(defcustom ellama-ollama-binary (executable-find "ollama")
+(defcustom ellama-ollama-binary "ollama"
   "Path to ollama binary."
   :type 'string
   :group 'ellama)
@@ -1549,9 +1549,11 @@ ARGS contains keys for fine control.
 :on-done ON-DONE -- ON-DONE a function that's called with
 the full response text when the request completes (with BUFFER current)."
   (interactive "sAsk ellama: ")
-  (let* ((providers (append
+  (let* ((ollama-binary (executable-find ellama-ollama-binary))
+        (providers (append
                      `(("default model" . ellama-provider)
-                      ,(if (and ellama-ollama-binary (file-exists-p 
ellama-ollama-binary))
+                      ,(if (and ollama-binary
+                                (file-exists-p ollama-binary))
                            '("ollama model" . 
(ellama-get-ollama-local-model))))
                      ellama-providers))
         (variants (mapcar #'car providers))
@@ -1926,7 +1928,9 @@ otherwise prompt user for URL to summarize."
                          (mapcar (lambda (s)
                                    (car (split-string s)))
                                  (seq-drop
-                                  (process-lines ellama-ollama-binary "ls") 
1))))
+                                  (process-lines
+                                   (executable-find ellama-ollama-binary) "ls")
+                                  1))))
        (host (when (llm-ollama-p ellama-provider)
                (llm-ollama-host ellama-provider)))
        (port (when (llm-ollama-p ellama-provider)
@@ -1941,12 +1945,14 @@ otherwise prompt user for URL to summarize."
 (defun ellama-provider-select ()
   "Select ellama provider."
   (interactive)
-  (let* ((providers (append
+  (let* ((ollama-binary (executable-find ellama-ollama-binary))
+        (providers (append
                      `(("default model" . ellama-provider)
-                              ,(if (and ellama-ollama-binary (file-exists-p 
ellama-ollama-binary))
-                                       '("ollama model" . 
(ellama-get-ollama-local-model))))
+                      ,(if (and ollama-binary
+                                (file-exists-p ollama-binary))
+                           '("ollama model" . 
(ellama-get-ollama-local-model))))
                      ellama-providers))
-            (variants (mapcar #'car providers)))
+        (variants (mapcar #'car providers)))
     (setq ellama-provider
          (eval (alist-get
                 (completing-read "Select model: " variants)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]