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

    Add ellama-session-kill functionality
    
    Added new function `ellama-session-kill` to select and kill an active 
session.
    Updated README.org with new command description. Modified the transient 
menu to
    include the new "Kill Session" option.
---
 README.org |  4 ++++
 ellama.el  | 13 ++++++++++++-
 2 files changed, 16 insertions(+), 1 deletion(-)

diff --git a/README.org b/README.org
index 9b491ff40c..205216a3dc 100644
--- a/README.org
+++ b/README.org
@@ -250,6 +250,10 @@ Delete ellama session.
 
 Change current active session.
 
+*** ellama-session-kill
+
+Select and kill one of active sessions.
+
 *** ellama-session-rename
 
 Rename current ellama session.
diff --git a/ellama.el b/ellama.el
index 92bdd3cd9e..3bfc2fbe19 100644
--- a/ellama.el
+++ b/ellama.el
@@ -1002,6 +1002,16 @@ If EPHEMERAL non nil new session will not be associated 
with any file."
     (display-buffer buffer (when ellama-chat-display-action-function
                             `((ignore . 
(,ellama-chat-display-action-function)))))))
 
+;;;###autoload
+(defun ellama-session-kill ()
+  "Select and kill one of active sessions."
+  (interactive)
+  (let* ((id (completing-read
+             "Select session to kill: "
+             (hash-table-keys ellama--active-sessions)))
+        (buffer (ellama-get-session-buffer id)))
+    (kill-buffer buffer)))
+
 ;;;###autoload
 (defun ellama-session-rename ()
   "Rename current ellama session."
@@ -3086,7 +3096,8 @@ Call CALLBACK on result list of strings.  ARGS contains 
keys for fine control.
     ("l" "Load Session" ellama-load-session)
     ("r" "Rename Session" ellama-session-rename)
     ("d" "Delete Session" ellama-session-delete)
-    ("a" "Activate Session" ellama-session-switch)]
+    ("a" "Activate Session" ellama-session-switch)
+    ("k" "Kill Session" ellama-session-kill)]
    ["Quit" ("q" "Quit" transient-quit-one)]])
 
 (transient-define-prefix ellama-transient-improve-menu ()

Reply via email to