branch: externals/ellama
commit 2e00f04790f944d50e6b9da932ebd8ffc21ff085
Author: Sergey Kostyaev <[email protected]>
Commit: Sergey Kostyaev <[email protected]>

    Fix duplicate system message handling in chat prompts
    
    Removed the redundant `llm-chat-prompt-append-response` call that was 
appending
    the system message on each interaction. The system message should be 
included in
    the initial prompt context setup, not appended repeatedly. Added a comment
    explaining this behavior.
---
 ellama.el | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/ellama.el b/ellama.el
index 78d2f2bd34..33788ab268 100644
--- a/ellama.el
+++ b/ellama.el
@@ -1596,10 +1596,8 @@ failure (with BUFFER current).
                                prompt-with-ctx)
                               (setf (llm-chat-prompt-tools 
(ellama-session-prompt session))
                                     tools)
-                              (when system
-                                (llm-chat-prompt-append-response
-                                 (ellama-session-prompt session)
-                                 system 'system))
+                              ;; System message is part of prompt context and 
should not be
+                              ;; appended on each interaction.
                               (ellama-session-prompt session))
                           (setf (ellama-session-prompt session)
                                 (llm-make-chat-prompt prompt-with-ctx :context 
system

Reply via email to