branch: externals/ellama
commit fb47f026ba6afe599382d700bc555fb5d4d9ca7a
Author: Sergey Kostyaev <[email protected]>
Commit: Sergey Kostyaev <[email protected]>
Improve system message handling
Added optional MSG parameter to ellama-get-system-message to allow callers
to
provide custom system message via the :system plist key, instead of always
using
the global default.
---
ellama.el | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/ellama.el b/ellama.el
index 11582f3697..c319bdfb4d 100644
--- a/ellama.el
+++ b/ellama.el
@@ -1241,9 +1241,10 @@ Returns the full path to AGENTS.md if found, or nil if
not found."
(buffer-string))))
""))
-(defun ellama-get-system-message ()
- "Return the effective system message, including dynamically scanned skills."
- (let ((msg (concat (or ellama-global-system "")
+(defun ellama-get-system-message (&optional msg)
+ "Return the effective system message, including dynamically scanned skills.
+MSG is a text that will be included in the resulting system message."
+ (let ((msg (concat (or msg ellama-global-system "")
(ellama-get-agents-md)
(ellama-skills-generate-prompt))))
(when (not (string= msg ""))
@@ -1548,8 +1549,7 @@ failure (with BUFFER current).
(error "Error calling the LLM: %s" msg))))
(donecb (or (plist-get args :on-done) #'ignore))
(prompt-with-ctx (ellama-context-prompt-with-context prompt))
- (system (or (plist-get args :system)
- (ellama-get-system-message)))
+ (system (ellama-get-system-message (plist-get args :system)))
(session-tools (and session
(ellama-session-extra session)
(plist-get (ellama-session-extra session)
:tools)))