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

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

[elpa] externals/ellama 6c8491bfc0 1/4: Factor out callback in ellama-ch


From: ELPA Syncer
Subject: [elpa] externals/ellama 6c8491bfc0 1/4: Factor out callback in ellama-chat to a separate named
Date: Sun, 7 Jan 2024 12:57:49 -0500 (EST)

branch: externals/ellama
commit 6c8491bfc0e774ef34173db6c75ae70f36c5c6f0
Author: T.V Raman <tv.raman.tv@gmail.com>
Commit: T.V Raman <tv.raman.tv@gmail.com>

    Factor out callback in ellama-chat to a separate named
    
    function so it can be advised or extended by external packages like 
Emacspeak.
---
 ellama.el | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/ellama.el b/ellama.el
index de83b3eb49..f54b75875b 100644
--- a/ellama.el
+++ b/ellama.el
@@ -257,6 +257,11 @@ when the request completes (with BUFFER current)."
                                (cancel-change-group ellama--change-group)
                                (spinner-stop)
                                (funcall errcb msg))))))))
+(defun ellama-chat-done (_)
+  "Chat done."
+  (save-excursion
+    (goto-char (point-max))
+    (insert "\n\n")))
 
 ;;;###autoload
 (defun ellama-chat (prompt)
@@ -274,9 +279,7 @@ when the request completes (with BUFFER current)."
              "## " ellama-assistant-nick ":\n")
       (ellama-stream prompt
                     :session t
-                    :on-done (lambda (_) (save-excursion
-                                     (goto-char (point-max))
-                                     (insert "\n\n")))))))
+                    :on-done #'ellama-chat-done))))
 
 ;;;###autoload
 (defalias 'ellama-ask 'ellama-chat)



reply via email to

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