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
  • Field Details

  • Constructor Details

    • JdbcChatMemoryRepository

      public JdbcChatMemoryRepository(org.springframework.jdbc.core.JdbcTemplate jdbcTemplate)
  • Method Details

    • checkAndCreateTable

      private void checkAndCreateTable()
    • findConversationIds

      public List<String> findConversationIds()
      Specified by:
      findConversationIds in interface org.springframework.ai.chat.memory.ChatMemoryRepository
    • findByConversationId

      public List<org.springframework.ai.chat.messages.Message> findByConversationId(String conversationId)
      Specified by:
      findByConversationId in interface org.springframework.ai.chat.memory.ChatMemoryRepository
    • saveAll

      public void saveAll(String conversationId, List<org.springframework.ai.chat.messages.Message> messages)
      Specified by:
      saveAll in interface org.springframework.ai.chat.memory.ChatMemoryRepository
    • deleteByConversationId

      public void deleteByConversationId(String conversationId)
      Specified by:
      deleteByConversationId in interface org.springframework.ai.chat.memory.ChatMemoryRepository
    • getAddSql

      protected String getAddSql()
      Get the SQL statement used to add records
      Returns:
      SQL
    • getGetSql

      protected String getGetSql()
      Get the SQL statement used for querying records
      Returns:
      SQL
    • hasTableSql

      protected abstract String hasTableSql(String tableName)
    • createTableSql

      protected abstract String createTableSql(String tableName)