Skip to content

Commit 54832fe

Browse files
committed
More renaming to be explicit about Chat memory repository
Signed-off-by: Ilayaperumal Gopinathan <[email protected]>
1 parent 2a15abf commit 54832fe

File tree

12 files changed

+26
-26
lines changed

12 files changed

+26
-26
lines changed

auto-configurations/models/chat/memory/repository/spring-ai-autoconfigure-model-chat-memory-repository-jdbc/src/main/java/org/springframework/ai/model/chat/memory/repository/jdbc/autoconfigure/JdbcChatMemoryRepositoryAutoConfiguration.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818

1919
import javax.sql.DataSource;
2020

21-
import org.springframework.ai.chat.memory.repository.jdbc.JdbcChatMemoryDialect;
21+
import org.springframework.ai.chat.memory.repository.jdbc.JdbcChatMemoryRepositoryDialect;
2222
import org.springframework.ai.chat.memory.repository.jdbc.JdbcChatMemoryRepository;
2323
import org.springframework.ai.model.chat.memory.autoconfigure.ChatMemoryAutoConfiguration;
2424
import org.springframework.boot.autoconfigure.AutoConfiguration;
@@ -45,7 +45,7 @@ public class JdbcChatMemoryRepositoryAutoConfiguration {
4545
@Bean
4646
@ConditionalOnMissingBean
4747
JdbcChatMemoryRepository jdbcChatMemoryRepository(JdbcTemplate jdbcTemplate, DataSource dataSource) {
48-
JdbcChatMemoryDialect dialect = JdbcChatMemoryDialect.from(dataSource);
48+
JdbcChatMemoryRepositoryDialect dialect = JdbcChatMemoryRepositoryDialect.from(dataSource);
4949
return JdbcChatMemoryRepository.builder().jdbcTemplate(jdbcTemplate).dialect(dialect).build();
5050
}
5151

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
import static org.assertj.core.api.Assertions.fail;
4141

4242
@RunWith(SpringRunner.class)
43-
@SpringBootTest(classes = JdbcChatMemoryHsqldbAutoConfigurationIT.TestConfig.class,
43+
@SpringBootTest(classes = JdbcChatMemoryRepositoryHsqldbAutoConfigurationIT.TestConfig.class,
4444
properties = { "spring.datasource.url=jdbc:hsqldb:mem:chat_memory_auto_configuration_test;DB_CLOSE_DELAY=-1",
4545
"spring.datasource.username=sa", "spring.datasource.password=",
4646
"spring.datasource.driver-class-name=org.hsqldb.jdbcDriver",
@@ -55,7 +55,7 @@
5555
org.springframework.boot.autoconfigure.jdbc.JdbcTemplateAutoConfiguration.class,
5656
org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration.class,
5757
SqlInitializationAutoConfiguration.class })
58-
public class JdbcChatMemoryHsqldbAutoConfigurationIT {
58+
public class JdbcChatMemoryRepositoryHsqldbAutoConfigurationIT {
5959

6060
@Autowired
6161
private ApplicationContext context;
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
* @author Linar Abzaltdinov
4141
* @author Yanming Zhou
4242
*/
43-
class JdbcChatMemoryPostgresqlAutoConfigurationIT {
43+
class JdbcChatMemoryRepositoryPostgresqlAutoConfigurationIT {
4444

4545
private final ApplicationContextRunner contextRunner = new ApplicationContextRunner()
4646
.withConfiguration(AutoConfigurations.of(JdbcChatMemoryRepositoryAutoConfiguration.class,
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
import static org.assertj.core.api.Assertions.assertThat;
2828

2929
@Testcontainers
30-
class JdbcChatMemorySqlServerAutoConfigurationIT {
30+
class JdbcChatMemoryRepositorySqlServerAutoConfigurationIT {
3131

3232
static final DockerImageName DEFAULT_IMAGE_NAME = DockerImageName
3333
.parse("mcr.microsoft.com/mssql/server:2022-latest");
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
/**
2020
* HSQLDB-specific SQL dialect for chat memory repository.
2121
*/
22-
public class HsqldbChatMemoryDialect implements JdbcChatMemoryDialect {
22+
public class HsqldbChatMemoryRepositoryDialect implements JdbcChatMemoryRepositoryDialect {
2323

2424
@Override
2525
public String getSelectMessagesSql() {

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,9 @@ public class JdbcChatMemoryRepository implements ChatMemoryRepository {
5151

5252
private final JdbcTemplate jdbcTemplate;
5353

54-
private final JdbcChatMemoryDialect dialect;
54+
private final JdbcChatMemoryRepositoryDialect dialect;
5555

56-
private JdbcChatMemoryRepository(JdbcTemplate jdbcTemplate, JdbcChatMemoryDialect dialect) {
56+
private JdbcChatMemoryRepository(JdbcTemplate jdbcTemplate, JdbcChatMemoryRepositoryDialect dialect) {
5757
Assert.notNull(jdbcTemplate, "jdbcTemplate cannot be null");
5858
Assert.notNull(dialect, "dialect cannot be null");
5959
this.jdbcTemplate = jdbcTemplate;
@@ -146,7 +146,7 @@ public static class Builder {
146146

147147
private JdbcTemplate jdbcTemplate;
148148

149-
private JdbcChatMemoryDialect dialect;
149+
private JdbcChatMemoryRepositoryDialect dialect;
150150

151151
private Builder() {
152152
}
@@ -156,7 +156,7 @@ public Builder jdbcTemplate(JdbcTemplate jdbcTemplate) {
156156
return this;
157157
}
158158

159-
public Builder dialect(JdbcChatMemoryDialect dialect) {
159+
public Builder dialect(JdbcChatMemoryRepositoryDialect dialect) {
160160
this.dialect = dialect;
161161
return this;
162162
}
Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
/**
2222
* Abstraction for database-specific SQL for chat memory repository.
2323
*/
24-
public interface JdbcChatMemoryDialect {
24+
public interface JdbcChatMemoryRepositoryDialect {
2525

2626
/**
2727
* Returns the SQL to fetch messages for a conversation, ordered by timestamp, with
@@ -51,25 +51,25 @@ public interface JdbcChatMemoryDialect {
5151
/**
5252
* Detects the dialect from the DataSource or JDBC URL.
5353
*/
54-
static JdbcChatMemoryDialect from(DataSource dataSource) {
54+
static JdbcChatMemoryRepositoryDialect from(DataSource dataSource) {
5555
// Simple detection (could be improved)
5656
try {
5757
String url = dataSource.getConnection().getMetaData().getURL().toLowerCase();
5858
if (url.contains("postgresql"))
59-
return new PostgresChatMemoryDialect();
59+
return new PostgresChatMemoryRepositoryDialect();
6060
if (url.contains("mysql"))
61-
return new MysqlChatMemoryDialect();
61+
return new MysqlChatMemoryRepositoryDialect();
6262
if (url.contains("mariadb"))
63-
return new MysqlChatMemoryDialect();
63+
return new MysqlChatMemoryRepositoryDialect();
6464
if (url.contains("sqlserver"))
65-
return new SqlServerChatMemoryDialect();
65+
return new SqlServerChatMemoryRepositoryDialect();
6666
if (url.contains("hsqldb"))
67-
return new HsqldbChatMemoryDialect();
67+
return new HsqldbChatMemoryRepositoryDialect();
6868
// Add more as needed
6969
}
7070
catch (Exception ignored) {
7171
}
72-
return new PostgresChatMemoryDialect(); // default
72+
return new PostgresChatMemoryRepositoryDialect(); // default
7373
}
7474

7575
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
* @author Mark Pollack
2323
* @since 1.0.0
2424
*/
25-
public class MysqlChatMemoryDialect implements JdbcChatMemoryDialect {
25+
public class MysqlChatMemoryRepositoryDialect implements JdbcChatMemoryRepositoryDialect {
2626

2727
@Override
2828
public String getSelectMessagesSql() {
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
* @author Mark Pollack
2323
* @since 1.0.0
2424
*/
25-
public class PostgresChatMemoryDialect implements JdbcChatMemoryDialect {
25+
public class PostgresChatMemoryRepositoryDialect implements JdbcChatMemoryRepositoryDialect {
2626

2727
@Override
2828
public String getSelectMessagesSql() {
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
* @author Mark Pollack
2323
* @since 1.0.0
2424
*/
25-
public class SqlServerChatMemoryDialect implements JdbcChatMemoryDialect {
25+
public class SqlServerChatMemoryRepositoryDialect implements JdbcChatMemoryRepositoryDialect {
2626

2727
@Override
2828
public String getSelectMessagesSql() {

0 commit comments

Comments
 (0)