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

    Fix setting provider and reset session ID
    
    Updated the `ellama-transient-set-provider` function to correctly set
    the provider and added logic to reset the current session ID when
    changing the provider.
---
 ellama.el | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/ellama.el b/ellama.el
index a93a9ba42f..116af5a7d9 100644
--- a/ellama.el
+++ b/ellama.el
@@ -2664,10 +2664,14 @@ Call CALLBACK on result list of strings.  ARGS contains 
keys for fine control.
 (transient-define-suffix ellama-transient-set-provider ()
   "Set transient model to provider."
   (interactive)
-  (set (read
-       (completing-read "Select provider: "
-                        (mapcar #'prin1-to-string ellama-provider-list)))
-       (ellama-construct-ollama-provider-from-transient)))
+  (let ((provider (read
+                  (completing-read "Select provider: "
+                                   (mapcar #'prin1-to-string 
ellama-provider-list)))))
+    (set provider
+        (ellama-construct-ollama-provider-from-transient))
+    ;; if you change `ellama-provider' you probably want to start new chat 
session
+    (when (equal provider 'ellama-provider)
+      (setq ellama--current-session-id nil))))
 
 (transient-define-prefix ellama-select-ollama-model ()
   "Select ollama model."

Reply via email to