From 65d2239b5d042fbdec1ad80733c9000cb91a676e Mon Sep 17 00:00:00 2001 From: Ahoo Wang Date: Thu, 15 May 2025 18:00:41 +0800 Subject: [PATCH] fix(memory): update message ordering in MySQL chat memory repository - Change the message ordering from descending to ascending in the MySQL chat memory repository - Remove the LIMIT clause to return all messages for a conversation --- .../repository/jdbc/MysqlChatMemoryRepositoryDialect.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/memory/repository/spring-ai-model-chat-memory-repository-jdbc/src/main/java/org/springframework/ai/chat/memory/repository/jdbc/MysqlChatMemoryRepositoryDialect.java b/memory/repository/spring-ai-model-chat-memory-repository-jdbc/src/main/java/org/springframework/ai/chat/memory/repository/jdbc/MysqlChatMemoryRepositoryDialect.java index a41fd76ee97..ee09c4ffeb2 100644 --- a/memory/repository/spring-ai-model-chat-memory-repository-jdbc/src/main/java/org/springframework/ai/chat/memory/repository/jdbc/MysqlChatMemoryRepositoryDialect.java +++ b/memory/repository/spring-ai-model-chat-memory-repository-jdbc/src/main/java/org/springframework/ai/chat/memory/repository/jdbc/MysqlChatMemoryRepositoryDialect.java @@ -26,7 +26,7 @@ public class MysqlChatMemoryRepositoryDialect implements JdbcChatMemoryRepositor @Override public String getSelectMessagesSql() { - return "SELECT content, type FROM SPRING_AI_CHAT_MEMORY WHERE conversation_id = ? ORDER BY `timestamp` DESC LIMIT ?"; + return "SELECT content, type FROM SPRING_AI_CHAT_MEMORY WHERE conversation_id = ? ORDER BY `timestamp` ASC"; } @Override