Package com.bytedesk.ai.alibaba.memory
Class JdbcChatMemoryRepository
java.lang.Object
com.bytedesk.ai.alibaba.memory.JdbcChatMemoryRepository
- All Implemented Interfaces:
org.springframework.ai.chat.memory.ChatMemoryRepository
- Direct Known Subclasses:
MysqlChatMemoryRepository
public abstract class JdbcChatMemoryRepository
extends Object
implements org.springframework.ai.chat.memory.ChatMemoryRepository
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static final recordprivate static class -
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionJdbcChatMemoryRepository(org.springframework.jdbc.core.JdbcTemplate jdbcTemplate) -
Method Summary
Modifier and TypeMethodDescriptionprivate voidprotected abstract StringcreateTableSql(String tableName) voiddeleteByConversationId(String conversationId) List<org.springframework.ai.chat.messages.Message>findByConversationId(String conversationId) protected StringGet the SQL statement used to add recordsprotected StringGet the SQL statement used for querying recordsprotected abstract StringhasTableSql(String tableName) void
-
Field Details
-
TABLE_NAME
- See Also:
-
QUERY_GET_IDS
- See Also:
-
QUERY_ADD
- See Also:
-
QUERY_GET
- See Also:
-
QUERY_CLEAR
- See Also:
-
jdbcTemplate
private final org.springframework.jdbc.core.JdbcTemplate jdbcTemplate
-
-
Constructor Details
-
JdbcChatMemoryRepository
public JdbcChatMemoryRepository(org.springframework.jdbc.core.JdbcTemplate jdbcTemplate)
-
-
Method Details
-
checkAndCreateTable
private void checkAndCreateTable() -
findConversationIds
- Specified by:
findConversationIdsin interfaceorg.springframework.ai.chat.memory.ChatMemoryRepository
-
findByConversationId
public List<org.springframework.ai.chat.messages.Message> findByConversationId(String conversationId) - Specified by:
findByConversationIdin interfaceorg.springframework.ai.chat.memory.ChatMemoryRepository
-
saveAll
public void saveAll(String conversationId, List<org.springframework.ai.chat.messages.Message> messages) - Specified by:
saveAllin interfaceorg.springframework.ai.chat.memory.ChatMemoryRepository
-
deleteByConversationId
- Specified by:
deleteByConversationIdin interfaceorg.springframework.ai.chat.memory.ChatMemoryRepository
-
getAddSql
Get the SQL statement used to add records- Returns:
- SQL
-
getGetSql
Get the SQL statement used for querying records- Returns:
- SQL
-
hasTableSql
-
createTableSql
-