Skip to content

fix(windows): 群聊笔记不再全部命名成「微信」 (#41) - #69

Merged
Hiwoniu merged 1 commit into
mainfrom
fix/windows-group-title
Nov 22, 2026
Merged

Hiwoniu merged 1 commit into
mainfrom
fix/windows-group-title

Conversation

@Hiwoniu

@Hiwoniu Hiwoniu commented Nov 21, 2026

Copy link
Copy Markdown
Collaborator

问题

在 Windows 微信 4.1.15 上,群聊转发到 Obsidian 后,笔记一律命名成「微信的聊天」。不同群的内容会合并进同一篇。

排查结果和 issue 一致:

  1. 新版微信的主窗口不再是 mmui::MainWindow,UIA 也读不到任何文本,第一步读群名失败。
  2. 接着退到读窗口标题(GetWindowText),读到的是 微信,被直接当成了群名。
  3. 因为第 2 步"成功"了,后面的 WeChatOcrTitleReader 降级没有执行。

改动

  • WeChatWindowTitleReader 新增 IsAppName:标题只是 微信 / Weixin / WeChat(不分大小写)时,视为没读到群名,流程继续走到 OCR 识别聊天头部的「群名 (N)」。
  • WeChatUiTitleReader 读到的 UIA 文本也做同样的过滤,避免以后新版本把 微信 暴露成文本元素又出同样的问题。
  • OCR 也没读到时,笔记按参与者命名(例如「张三等5人的聊天」),不同的群不会再合并到同一篇。
  • 新增测试 WindowTitleReaderIgnoresTheAppName。

验证

  • 本地没有 Windows 环境,编译和测试都靠这个 PR 的 CI。
  • 修复的效果取决于 OCR 能不能识别出新版微信的聊天头部,还没在真机上验证。@quocbaclam33980-stack 如果方便,麻烦用这个分支构建的版本在 4.1.15.13 上帮忙试一下。
  • 私聊头部没有成员数,OCR 不会采用,所以私聊在新版微信下仍会按参与者命名(和原来一样,只是不会再串到别人的笔记里)。

Fixes #41

🤖 Generated with Claude Code

WeChat 4.x titles its main window 「微信」 whatever chat is open, and newer
builds no longer expose the mmui::MainWindow UIA tree. The UIA read came
back empty, the window-title fallback returned 「微信」, and that was taken
as the group name — so the OCR fallback never ran and every group landed
in the same 「微信的聊天.md」.

A title that is only the app name (微信 / Weixin / WeChat) now reads as no
name in both the window-title and UIA readers, so the chain falls through
to OCR of the chat header. If that also fails, the note is named after
the participants instead of a shared 「微信」.

Fixes #41

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Hiwoniu
Hiwoniu merged commit 69120fc into main Nov 22, 2026
2 checks passed
@Hiwoniu
Hiwoniu deleted the fix/windows-group-title branch November 22, 2026 17:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Windows] 群聊笔记命名失败:微信 4.1.15.13 下所有群都被命名成「微信的聊天」

2 participants