From bd4296199a6d6cdb425150223077005680fb4f5b Mon Sep 17 00:00:00 2001 From: xuncha <1658671838@qq.com> Date: Fri, 13 Mar 2026 19:38:17 +0800 Subject: [PATCH] =?UTF-8?q?=E5=9B=BE=E7=89=87=E8=A7=A3=E5=AF=86=E5=A4=B1?= =?UTF-8?q?=E8=B4=A5=E7=9A=84=E6=97=B6=E5=80=99=20=E5=8F=AF=E4=BB=A5?= =?UTF-8?q?=E5=AF=BC=E5=87=BA=E7=BC=A9=E7=95=A5=E5=9B=BE=20html?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- electron/services/exportService.ts | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/electron/services/exportService.ts b/electron/services/exportService.ts index 20864a5..d4b36ea 100644 --- a/electron/services/exportService.ts +++ b/electron/services/exportService.ts @@ -2157,12 +2157,22 @@ class ExportService { imageMd5, imageDatName }) - if (!thumbResult.success || !thumbResult.localPath) { - console.log(`[Export] 缩略图也获取失败 (localId=${msg.localId}): error=${thumbResult.error || '未知'} → 将显示 [图片] 占位符`) - return null + if (thumbResult.success && thumbResult.localPath) { + console.log(`[Export] 使用缩略图替代 (localId=${msg.localId}): ${thumbResult.localPath}`) + result.localPath = thumbResult.localPath + } else { + console.log(`[Export] 缩略图也获取失败 (localId=${msg.localId}): error=${thumbResult.error || '未知'}`) + // 最后尝试:直接从 imageStore 获取缓存的缩略图 data URL + const { imageStore } = await import('../main') + const cachedThumb = imageStore?.getCachedImage(sessionId, imageMd5, imageDatName) + if (cachedThumb) { + console.log(`[Export] 从 imageStore 获取到缓存缩略图 (localId=${msg.localId})`) + result.localPath = cachedThumb + } else { + console.log(`[Export] 所有方式均失败 → 将显示 [图片] 占位符`) + return null + } } - console.log(`[Export] 使用缩略图替代 (localId=${msg.localId}): ${thumbResult.localPath}`) - result.localPath = thumbResult.localPath } // 为每条消息生成稳定且唯一的文件名前缀,避免跨日期/消息发生同名覆盖