From c68ff23b011c1b73111adbf26bd8e8326f064199 Mon Sep 17 00:00:00 2001 From: mudler Date: Wed, 18 Dec 2024 17:44:52 +0100 Subject: [PATCH] Small fixups Signed-off-by: mudler --- agent/agent.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/agent/agent.go b/agent/agent.go index 40d285b..b38d837 100644 --- a/agent/agent.go +++ b/agent/agent.go @@ -348,7 +348,7 @@ func (a *Agent) consumeJob(job *Job, role string) { // Walk conversation from bottom to top, and find the first message of the user // to use it as a query to the KB var userMessage string - for i := len(a.currentConversation); i == 0; i-- { + for i := len(a.currentConversation) - 1; i >= 0; i-- { xlog.Info("[Long term memory] Conversation", "role", a.currentConversation[i].Role, "Content", a.currentConversation[i].Content) if a.currentConversation[i].Role == "user" { userMessage = a.currentConversation[i].Content