You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- set timestamp manually to prevent saving equal timestamps while batch insert
- return DESC order into get query (in `JdbcChatMemory`)
- Update similar changes for JdbcChatMemoryRepository
This PR solves some problems with message ordering:
JdbcChatMemory fetches rows in DESC order, and MessageChatMemoryAdvisor get and add all messages in that order - from last to first. So messages list needs to be reversed.
After batch insert without specifying timestamp manually all rows have the same timestamp (because database sets current_timestamp by default). Sooo after fetching rows from database the message order is unpredictable - they have same timestamp.
Signed-off-by: Linar Abzaltdinov <[email protected]>
Copy file name to clipboardExpand all lines: auto-configurations/models/chat/memory/spring-ai-autoconfigure-model-chat-memory-jdbc/src/test/java/org/springframework/ai/model/chat/memory/jdbc/autoconfigure/JdbcChatMemoryPostgresqlAutoConfigurationIT.java
Copy file name to clipboardExpand all lines: memory/spring-ai-model-chat-memory-jdbc/src/main/java/org/springframework/ai/chat/memory/jdbc/JdbcChatMemory.java
Copy file name to clipboardExpand all lines: memory/spring-ai-model-chat-memory-jdbc/src/main/java/org/springframework/ai/chat/memory/jdbc/JdbcChatMemoryRepository.java
Copy file name to clipboardExpand all lines: memory/spring-ai-model-chat-memory-jdbc/src/main/resources/org/springframework/ai/chat/memory/jdbc/schema-mariadb.sql
+2-2
Original file line number
Diff line number
Diff line change
@@ -2,9 +2,9 @@ CREATE TABLE IF NOT EXISTS ai_chat_memory (
Copy file name to clipboardExpand all lines: memory/spring-ai-model-chat-memory-jdbc/src/main/resources/org/springframework/ai/chat/memory/jdbc/schema-postgresql.sql
+3-3
Original file line number
Diff line number
Diff line change
@@ -2,8 +2,8 @@ CREATE TABLE IF NOT EXISTS ai_chat_memory (
2
2
conversation_id VARCHAR(36) NOT NULL,
3
3
content TEXTNOT NULL,
4
4
type VARCHAR(10) NOT NULLCHECK (type IN ('USER', 'ASSISTANT', 'SYSTEM', 'TOOL')),
Copy file name to clipboardExpand all lines: memory/spring-ai-model-chat-memory-jdbc/src/test/java/org/springframework/ai/chat/memory/jdbc/JdbcChatMemoryIT.java
0 commit comments