branch: externals/ellama
commit b1eb3578bf1601c0e1a5de6babc6043c470a6921
Author: Sergey Kostyaev <sskosty...@gmail.com>
Commit: Sergey Kostyaev <sskosty...@gmail.com>

    Add transient suffix for loading model from current session
    
    It can be useful to continue some previous conversation.
---
 ellama.el | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/ellama.el b/ellama.el
index 2b3c258f5d..2deb4bbfc6 100644
--- a/ellama.el
+++ b/ellama.el
@@ -2694,6 +2694,14 @@ Call CALLBACK on result list of strings.  ARGS contains 
keys for fine control.
          (completing-read "Select provider: "
                           (mapcar #'prin1-to-string ellama-provider-list))))))
 
+(transient-define-suffix ellama-transient-model-get-from-current-session ()
+  "Fill transient model from current session."
+  (interactive)
+  (when ellama--current-session-id
+    (ellama-fill-transient-ollama-model
+     (with-current-buffer (ellama-get-session-buffer 
ellama--current-session-id)
+       (ellama-session-provider ellama--current-session)))))
+
 (transient-define-suffix ellama-transient-set-provider ()
   "Set transient model to provider."
   (interactive)
@@ -2711,6 +2719,8 @@ Call CALLBACK on result list of strings.  ARGS contains 
keys for fine control.
   [["Model"
     ("f" "Load from provider" ellama-transient-model-get-from-provider
      :transient t)
+    ("F" "Load from current session" 
ellama-transient-model-get-from-current-session
+     :transient t)
     ("m" "Set Model" ellama-transient-set-ollama-model
      :transient t
      :description (lambda () (format "Model (%s)" 
ellama-transient-ollama-model-name)))

Reply via email to