feat: 合并聊天记录优化

This commit is contained in:
digua
2025-12-02 00:37:20 +08:00
parent d70549c9b1
commit b43191c7e0
8 changed files with 262 additions and 36 deletions

View File

@@ -77,6 +77,7 @@ interface MergeApi {
parseFileInfo: (filePath: string) => Promise<FileParseInfo>
checkConflicts: (filePaths: string[]) => Promise<ConflictCheckResult>
mergeFiles: (params: MergeParams) => Promise<MergeResult>
clearCache: (filePath?: string) => Promise<boolean>
onParseProgress: (callback: (data: { filePath: string; progress: ImportProgress }) => void) => () => void
}

View File

@@ -290,6 +290,7 @@ const chatApi = {
const mergeApi = {
/**
* 解析文件获取基本信息(用于合并预览)
* 解析后结果会被缓存,后续合并时无需再次读取原始文件
*/
parseFileInfo: (filePath: string): Promise<FileParseInfo> => {
return ipcRenderer.invoke('merge:parseFileInfo', filePath)
@@ -309,6 +310,14 @@ const mergeApi = {
return ipcRenderer.invoke('merge:mergeFiles', params)
},
/**
* 清理解析缓存
* @param filePath 可选,指定文件路径则清理该文件的缓存,否则清理所有缓存
*/
clearCache: (filePath?: string): Promise<boolean> => {
return ipcRenderer.invoke('merge:clearCache', filePath)
},
/**
* 监听解析进度(用于大文件)
*/