Skip to content

Commit 65d2239

Browse files
committed
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
1 parent 3fb6692 commit 65d2239

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

memory/repository/spring-ai-model-chat-memory-repository-jdbc/src/main/java/org/springframework/ai/chat/memory/repository/jdbc/MysqlChatMemoryRepositoryDialect.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ public class MysqlChatMemoryRepositoryDialect implements JdbcChatMemoryRepositor
2626

2727
@Override
2828
public String getSelectMessagesSql() {
29-
return "SELECT content, type FROM SPRING_AI_CHAT_MEMORY WHERE conversation_id = ? ORDER BY `timestamp` DESC LIMIT ?";
29+
return "SELECT content, type FROM SPRING_AI_CHAT_MEMORY WHERE conversation_id = ? ORDER BY `timestamp` ASC";
3030
}
3131

3232
@Override

0 commit comments

Comments
 (0)