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

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

[elpa] externals/ellama 447c4ddd88 17/37: Enhance ellama-complete filter


From: ELPA Syncer
Subject: [elpa] externals/ellama 447c4ddd88 17/37: Enhance ellama-complete filtering
Date: Sat, 8 Mar 2025 06:58:35 -0500 (EST)

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

    Enhance ellama-complete filtering
    
    Refined the ellama-complete function to include additional context for 
filtering
    by considering the last line and word of the selected text. This provides 
more
    accurate trimming of responses related to the input content.
---
 ellama.el | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/ellama.el b/ellama.el
index e69c4f6b9c..e2d6362806 100644
--- a/ellama.el
+++ b/ellama.el
@@ -2639,10 +2639,14 @@ the full response text when the request completes (with 
BUFFER current)."
         (end (if (region-active-p)
                  (region-end)
                (point)))
-        (text (buffer-substring-no-properties beg end)))
+        (text (buffer-substring-no-properties beg end))
+        (line (car (reverse (string-lines text))))
+        (word (car (reverse (string-split line " ")))))
     (ellama-stream text
                   :system ellama-complete-prompt-template
-                  :filter (lambda (s) (string-trim-left s (rx (literal 
text)))))))
+                  :filter (lambda (s) (string-trim-left s (rx (or (literal 
text)
+                                                                  (literal 
line)
+                                                                  (literal 
word))))))))
 
 (defvar vc-git-diff-switches)
 (declare-function vc-diff-internal "vc")



reply via email to

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