mirror of
https://github.com/ILoveBingLu/CipherTalk.git
synced 2026-05-23 04:53:24 +08:00
feat(chat): 新增聊天记录独立窗口和日期查询功能
- 新增聊天记录独立窗口(ChatHistoryPage),支持在单独窗口中查看完整聊天记录 - 实现 createChatHistoryWindow 函数,支持窗口复用和主题适配 - 新增 IPC 处理器用于打开聊天记录窗口和获取单条消息 - 添加 getMessagesByDate 和 getDatesWithMessages 方法,支持按日期查询消息 - 在 preload.ts 中暴露新的 IPC 调用接口 - 新增 ChatHistoryPage.tsx 和 ChatHistoryPage.scss 组件文件 - 更新 package.json 依赖项和 package-lock.json - 更新 README.md,新增爱发电赞助支持入口 - 添加爱发电二维码图片资源 - 版本号更新至 2.1.6 - 优化聊天页面和设置页面的用户体验 - 更新类型定义和配置文件以支持新功能
This commit is contained in:
@@ -1237,6 +1237,12 @@ class DataManagementService {
|
||||
* 启用自动更新(文件监听 + 定时检查)
|
||||
*/
|
||||
enableAutoUpdate(intervalSeconds: number = 30): void {
|
||||
// 检查配置是否允许自动更新
|
||||
if (!this.configService.get('autoUpdateDatabase')) {
|
||||
console.log('[DataManagement] 自动更新配置为关闭,跳过启动')
|
||||
return
|
||||
}
|
||||
|
||||
if (this.autoUpdateEnabled) {
|
||||
this.disableAutoUpdate()
|
||||
}
|
||||
@@ -1251,6 +1257,11 @@ class DataManagementService {
|
||||
this.autoUpdateInterval = setInterval(async () => {
|
||||
if (this.isUpdating) return
|
||||
|
||||
// 再次检查配置,以防运行时被修改
|
||||
if (!this.configService.get('autoUpdateDatabase')) {
|
||||
return
|
||||
}
|
||||
|
||||
const checkResult = await this.checkForUpdates()
|
||||
if (checkResult.hasUpdate) {
|
||||
// 通知监听器
|
||||
@@ -1342,6 +1353,9 @@ class DataManagementService {
|
||||
this.dbWatcher = fs.watch(dbStoragePath, { recursive: true }, async (eventType, filename) => {
|
||||
if (!filename || this.isUpdating) return
|
||||
|
||||
// 检查配置
|
||||
if (!this.configService.get('autoUpdateDatabase')) return
|
||||
|
||||
// 只监听 .db 文件
|
||||
if (!filename.toLowerCase().endsWith('.db')) return
|
||||
|
||||
@@ -1392,6 +1406,11 @@ class DataManagementService {
|
||||
* 触发更新(带频率限制和队列管理)
|
||||
*/
|
||||
private triggerUpdate(): void {
|
||||
// 检查配置
|
||||
if (!this.configService.get('autoUpdateDatabase')) {
|
||||
return
|
||||
}
|
||||
|
||||
// 如果正在更新,增加待处理计数
|
||||
if (this.isUpdating) {
|
||||
this.pendingUpdateCount++
|
||||
@@ -1432,6 +1451,11 @@ class DataManagementService {
|
||||
* @param silent 是否静默更新(不显示进度)
|
||||
*/
|
||||
async autoIncrementalUpdate(silent: boolean = false): Promise<{ success: boolean; updated: boolean; error?: string }> {
|
||||
// 检查配置
|
||||
if (!this.configService.get('autoUpdateDatabase')) {
|
||||
return { success: true, updated: false }
|
||||
}
|
||||
|
||||
if (this.isUpdating) {
|
||||
// 如果正在更新,返回待处理状态
|
||||
this.pendingUpdateCount++
|
||||
|
||||
Reference in New Issue
Block a user