From afa3e089b1a599d114609a37b57def1147776ed6 Mon Sep 17 00:00:00 2001 From: xuncha <1658671838@qq.com> Date: Sat, 17 Jan 2026 02:33:02 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E8=87=AA=E5=B7=B1=E5=8F=91=E7=9A=84?= =?UTF-8?q?=E8=AF=AD=E9=9F=B3=E4=B9=9F=E5=8F=AF=E4=BB=A5=E8=A7=A3=E5=AF=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- electron/services/chatService.ts | 41 +++++++++++++++++++++++++++++++- 1 file changed, 40 insertions(+), 1 deletion(-) diff --git a/electron/services/chatService.ts b/electron/services/chatService.ts index 1e7457a..d4ef5f5 100644 --- a/electron/services/chatService.ts +++ b/electron/services/chatService.ts @@ -1725,6 +1725,45 @@ class ChatService { return join(documentsPath, 'WeFlow', 'Emojis') } + clearCaches(options?: { includeMessages?: boolean; includeContacts?: boolean; includeEmojis?: boolean }): { success: boolean; error?: string } { + const includeMessages = options?.includeMessages !== false + const includeContacts = options?.includeContacts !== false + const includeEmojis = options?.includeEmojis !== false + const errors: string[] = [] + + if (includeContacts) { + this.avatarCache.clear() + this.contactCacheService.clear() + } + + if (includeMessages) { + this.messageCacheService.clear() + } + + for (const state of this.hardlinkCache.values()) { + try { + state.db?.close() + } catch { } + } + this.hardlinkCache.clear() + + if (includeEmojis) { + emojiCache.clear() + emojiDownloading.clear() + const emojiDir = this.getEmojiCacheDir() + try { + fs.rmSync(emojiDir, { recursive: true, force: true }) + } catch (error) { + errors.push(String(error)) + } + } + + if (errors.length > 0) { + return { success: false, error: errors.join('; ') } + } + return { success: true } + } + /** * 下载并缓存表情包 */ @@ -2109,7 +2148,7 @@ class ChatService { if (!msgResult.success || !msgResult.message) return { success: false, error: '未找到该消息' } const msg = msgResult.message if (msg.isSend === 1) { - return { success: false, error: '暂不支持解密自己发送的语音' } + console.info('[ChatService][Voice] self-sent voice, continue decrypt flow') } const candidates = this.getVoiceLookupCandidates(sessionId, msg)