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

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

[elpa] externals/ellama 50383d995a 4/5: Add ellama-chat-done-callback


From: ELPA Syncer
Subject: [elpa] externals/ellama 50383d995a 4/5: Add ellama-chat-done-callback
Date: Sun, 7 Jan 2024 18:57:58 -0500 (EST)

branch: externals/ellama
commit 50383d995a20071387c4e9763cbbf8cefddb5e6b
Author: Sergey Kostyaev <sskostyaev@gmail.com>
Commit: Sergey Kostyaev <sskostyaev@gmail.com>

    Add ellama-chat-done-callback
    
    Fixes #26
---
 NEWS.org  |  2 ++
 README.md |  3 +++
 ellama.el | 17 +++++++++++++----
 3 files changed, 18 insertions(+), 4 deletions(-)

diff --git a/NEWS.org b/NEWS.org
index 686b07c326..84d2ceedec 100644
--- a/NEWS.org
+++ b/NEWS.org
@@ -1,3 +1,5 @@
+* Version 0.5.5
+- Add ellama-chat-done-callback.
 * Version 0.5.4
 - Support interactive switch models on remote host.
 * Version 0.5.3
diff --git a/README.md b/README.md
index a418e2c90f..dc5ca0a6ab 100644
--- a/README.md
+++ b/README.md
@@ -210,6 +210,9 @@ documentation](https://elpa.gnu.org/packages/llm.html)
 - `ellama-name-prompt-words-count`: Count of words in prompt to
   generate name.
 - Prompt templates for every command.
+- `ellama-chat-done-callback`: Callback that will be called on ellama
+chat response generation done. It should be a function with single
+argument generated text string.
 
 ## Acknowledgments
 
diff --git a/ellama.el b/ellama.el
index 34edbe9fdd..311108f2e4 100644
--- a/ellama.el
+++ b/ellama.el
@@ -6,7 +6,7 @@
 ;; URL: http://github.com/s-kostyaev/ellama
 ;; Keywords: help local tools
 ;; Package-Requires: ((emacs "28.1") (llm "0.6.0") (spinner "1.7.4"))
-;; Version: 0.5.4
+;; Version: 0.5.5
 ;; SPDX-License-Identifier: GPL-3.0-or-later
 ;; Created: 8th Oct 2023
 
@@ -254,6 +254,12 @@
   :group 'ellama
   :type 'string)
 
+(defcustom ellama-chat-done-callback nil
+  "Callback that will be called on ellama chat response generation done.
+It should be a function with single argument generated text string."
+  :group 'ellama
+  :type 'function)
+
 (defvar-local ellama--chat-prompt nil)
 
 (defvar-local ellama--change-group nil)
@@ -384,11 +390,14 @@ when the request completes (with BUFFER current)."
                                      (funcall errcb msg)
                                      (setq ellama--current-request nil)))))))))
 
-(defun ellama-chat-done (_)
-  "Chat done."
+(defun ellama-chat-done (text)
+  "Chat done.
+Will call `ellama-chat-done-callback' on TEXT."
   (save-excursion
     (goto-char (point-max))
-    (insert "\n\n")))
+    (insert "\n\n"))
+  (when ellama-chat-done-callback
+    (funcall ellama-chat-done-callback text)))
 
 ;;;###autoload
 (defun ellama-chat (prompt)



reply via email to

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