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

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

[elpa] externals/ellama f381e5bdc2 1/5: Fix context for translations


From: ELPA Syncer
Subject: [elpa] externals/ellama f381e5bdc2 1/5: Fix context for translations
Date: Sun, 25 Feb 2024 15:57:59 -0500 (EST)

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

    Fix context for translations
---
 ellama.el | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/ellama.el b/ellama.el
index 5477bab697..c6115fb0d3 100644
--- a/ellama.el
+++ b/ellama.el
@@ -822,10 +822,9 @@ If EPHEMERAL non nil new session will not be associated 
with any file."
     (_
      (user-error "Unsupported context element"))))
 
-(defun ellama--format-context ()
-  "Format current session context for chat buffer."
-  (if-let* ((session ellama--current-session)
-           (context (ellama-session-context session)))
+(defun ellama--format-context (session)
+  "Format SESSION context for chat buffer."
+  (if-let* ((context (ellama-session-context session)))
       (concat (string-join
               (cons "Context:"
                     (if (derived-mode-p 'org-mode)
@@ -1000,7 +999,7 @@ Translation to %s:
       (save-excursion
        (goto-char (point-max))
        (insert ellama-nick-prefix " " ellama-user-nick ":\n"
-               (ellama--format-context) result "\n\n"
+               (ellama--format-context session) result "\n\n"
                ellama-nick-prefix " " ellama-assistant-nick ":\n")
        (ellama-stream result
                       :session session
@@ -1015,7 +1014,7 @@ Translation to %s:
     (save-excursion
       (goto-char (point-max))
       (insert ellama-nick-prefix " " ellama-user-nick ":\n"
-             (ellama--format-context) prompt "\n\n"
+             (ellama--format-context session) prompt "\n\n"
              ellama-nick-prefix " " ellama-assistant-nick ":\n")
       (ellama-stream
        (format "Translate this text to english.
@@ -1079,7 +1078,7 @@ ARGS contains keys for fine control.
        (save-excursion
          (goto-char (point-max))
          (insert ellama-nick-prefix " " ellama-user-nick ":\n"
-                 (ellama--format-context) prompt "\n\n"
+                 (ellama--format-context session) prompt "\n\n"
                  ellama-nick-prefix " " ellama-assistant-nick ":\n")
          (ellama-stream prompt
                         :session session



reply via email to

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