Skip to content

AI-native knowledge base & Evernote/Obsidian alternative with instant sync & native MCP. Free on Cloudflare or self-hosted via Docker.

fix(desktop): remove redundant summary card from WeChat chat import

tianma-if3470ecfe0c3b
diff --git a/apps/desktop/src/main/wechat-chat-archive.mjs b/apps/desktop/src/main/wechat-chat-archive.mjs
index dd9cdb29..4249e5ed 100644
--- a/apps/desktop/src/main/wechat-chat-archive.mjs
+++ b/apps/desktop/src/main/wechat-chat-archive.mjs
@@ -458,42 +458,6 @@ const formatHeader = (sender, time, state) => {
return `**${escapeMarkdownText(sender)}** · ${date} ${clock}`;
};
-const buildSummaryCard = (messages, mediaItems) => {
- const structured = messages.filter((m) => !m.raw && m.sender && m.time);
- if (structured.length < 2) return null;
-
- const senders = [...new Set(structured.map((m) => m.sender))];
- const firstTime = structured[0]?.time;
- const lastTime = structured.at(-1)?.time;
-
- let timeRange = firstTime;
- if (lastTime && lastTime !== firstTime) {
- const firstMatch = /^(\d{4}年\d{1,2}月\d{1,2}日)\s+(\d{1,2}:\d{2})/.exec(firstTime || "");
- const lastMatch = /^(\d{4}年\d{1,2}月\d{1,2}日)\s+(\d{1,2}:\d{2})/.exec(lastTime || "");
- if (firstMatch && lastMatch && firstMatch[1] === lastMatch[1]) {
- timeRange = `${firstTime} ~ ${lastMatch[2]}`;
- } else {
- timeRange = `${firstTime} ~ ${lastTime}`;
- }
- }
-
- const imageCount = mediaItems.filter((item) => isImage(item.filename)).length;
- const otherCount = mediaItems.length - imageCount;
- const mediaSummary = [];
- if (imageCount > 0) mediaSummary.push(`${imageCount} 张图片`);
- if (otherCount > 0) mediaSummary.push(`${otherCount} 个附件`);
-
- const lines = [
- "> 💬 **微信聊天记录**",
- `> **参与者**:${senders.map(escapeMarkdownText).join("、")}`,
- `> **时间**:${escapeMarkdownText(timeRange)} · 共 ${structured.length} 条消息`,
- ];
- if (mediaSummary.length > 0) {
- lines.push(`> **包含媒体**:${mediaSummary.join("、")}`);
- }
- return lines.join("\n");
-};
-
const titleTimestamp = (time) => {
const match = /^(\d{4})年(\d{1,2})月(\d{1,2})日 (\d{1,2}):(\d{2})(?::\d{2})?$/.exec(time || "");
if (!match) return null;
@@ -566,8 +530,7 @@ export const wechatChatNoteFromArchive = (bytes, archiveName = TRANSCRIPT_NAME)
})
: [escapeMarkdownText(text.trim())];
const unused = items.filter((item) => !item.used).map((item) => mediaMarkdown(item));
- const summaryCard = buildSummaryCard(messages, items);
- const markdown = [summaryCard, ...sections, ...unused].filter(Boolean).join("\n\n").trim();
+ const markdown = [...sections, ...unused].filter(Boolean).join("\n\n").trim();
if (!markdown) throw new WeChatArchiveError("unrecognized");
return {
title: archiveTitle(archiveName, messages),
diff --git a/apps/desktop/src/main/wechat-chat-archive.test.mjs b/apps/desktop/src/main/wechat-chat-archive.test.mjs
index 6818738d..cb4de269 100644
--- a/apps/desktop/src/main/wechat-chat-archive.test.mjs
+++ b/apps/desktop/src/main/wechat-chat-archive.test.mjs
@@ -94,9 +94,7 @@ describe("WeChat chat archive", () => {
test("turns the exported zip into messages, an inline image, and attachments", () => {
const note = wechatChatNoteFromArchive(sampleArchive(), "聊天记录_20260922_223222.zip");
expect(note.title).toBe("聊天记录_20260922_223222");
- expect(note.markdown).toContain("> 💬 **微信聊天记录**");
- expect(note.markdown).toContain("> **参与者**:鱼、Flechazo");
- expect(note.markdown).toContain("> **包含媒体**:1 张图片、2 个附件");
+ expect(note.markdown).not.toContain("💬 **微信聊天记录**");
expect(note.markdown).toContain("**鱼** · 2026年9月22日 22:15");
expect(note.markdown).toContain("[发布说明](https://example.com/post)");
expect(note.markdown).toContain("![微信图片_202609222215_1.jpg](edgeever-wechat-media://m1)");