feat: 落地聊天记录异步持久化基础设施

- 新增 chatlog 模块、AnalyticalDB 公共层与 common-mq Redis Streams 实现

- 建立 Redis 热态、MySQL 热数据、AnalyticalDB 历史查询与同步链路

- 收紧聊天记录幂等、摘要时序与持久化失败语义
This commit is contained in:
2026-04-05 11:35:05 +08:00
parent 1ecc28e498
commit 25e80433a5
105 changed files with 8050 additions and 2 deletions

View File

@@ -0,0 +1,48 @@
package tech.easyflow.chatlog.config;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;
import java.time.Duration;
@Component
@ConfigurationProperties(prefix = "easyflow.chat.cache")
public class ChatCacheProperties {
private Duration sessionListTtl = Duration.ofMinutes(5);
private Duration sessionSummaryTtl = Duration.ofMinutes(10);
private Duration sessionTailTtl = Duration.ofMinutes(30);
private int tailSize = 50;
public Duration getSessionListTtl() {
return sessionListTtl;
}
public void setSessionListTtl(Duration sessionListTtl) {
this.sessionListTtl = sessionListTtl;
}
public Duration getSessionSummaryTtl() {
return sessionSummaryTtl;
}
public void setSessionSummaryTtl(Duration sessionSummaryTtl) {
this.sessionSummaryTtl = sessionSummaryTtl;
}
public Duration getSessionTailTtl() {
return sessionTailTtl;
}
public void setSessionTailTtl(Duration sessionTailTtl) {
this.sessionTailTtl = sessionTailTtl;
}
public int getTailSize() {
return tailSize;
}
public void setTailSize(int tailSize) {
this.tailSize = tailSize;
}
}

View File

@@ -0,0 +1,55 @@
package tech.easyflow.chatlog.config;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;
@Component
@ConfigurationProperties(prefix = "easyflow.chat.sync")
public class ChatSyncProperties {
private boolean enabled = false;
private int batchSize = 500;
private long fixedDelay = 30000L;
private int repairLookbackDays = 3;
private int retentionMonths = 3;
public boolean isEnabled() {
return enabled;
}
public void setEnabled(boolean enabled) {
this.enabled = enabled;
}
public int getBatchSize() {
return batchSize;
}
public void setBatchSize(int batchSize) {
this.batchSize = batchSize;
}
public long getFixedDelay() {
return fixedDelay;
}
public void setFixedDelay(long fixedDelay) {
this.fixedDelay = fixedDelay;
}
public int getRepairLookbackDays() {
return repairLookbackDays;
}
public void setRepairLookbackDays(int repairLookbackDays) {
this.repairLookbackDays = repairLookbackDays;
}
public int getRetentionMonths() {
return retentionMonths;
}
public void setRetentionMonths(int retentionMonths) {
this.retentionMonths = retentionMonths;
}
}

View File

@@ -0,0 +1,9 @@
package tech.easyflow.chatlog.config;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.autoconfigure.AutoConfiguration;
@AutoConfiguration
@MapperScan("tech.easyflow.chatlog.mapper")
public class ChatlogModuleConfig {
}