mirror of
https://github.com/jackwener/wx-cli.git
synced 2026-10-08 07:15:46 +00:00
feat(unread): 按 chat_type 分类会话,新增 --filter (#9)
Before: wx unread / sessions / history 把公众号、订阅号折叠入口 (brandsessionholder)、折叠群聊(@placeholder_foldgroup)、认证服务号 全归为 is_group=false,与真私聊混在一起。甚至 username 形如 wxid_* 但 实为公众号的条目也完全分不出来。 改动: - 新增 chat_type_of(username, names) helper,输出固定为 group / official_account / folded / private。 - 判据依次:@chatroom → group;brandsessionholder / @placeholder_foldgroup → folded;contact.verify_flag != 0 → official_account(覆盖 wxid_* 伪装为公众号的情况,以及银行/品牌服务号、qqsafe / mphelper 等认证账号); gh_* / biz_* / @* 前缀兜底;其余为 private。 - load_names 顺带读 contact.verify_flag,Names::is_verified 封装查询。 - q_sessions / q_unread / q_history / q_new_messages / q_stats 输出 新增 chat_type 字段,is_group 保留向后兼容并统一由 chat_type 派生。 - wx unread 新增 --filter,clap value_parser 限制可选值为 all / private / group / official / folded,逗号分隔多选,默认 all。 例:wx unread --filter private,group 可过滤公众号与折叠入口。 - SKILL.md / README.md 补充新字段与用法说明。 - .gitignore 补 target/(Rust 项目标配)。 性能:默认 wx unread 的 SQL 与改动前相同(保留 LIMIT)。仅当传入 --filter 时改为全表扫再 Rust 侧过滤,否则 SQL LIMIT 会先把匹配 filter 的条目截断导致漏召。
This commit is contained in:
@@ -106,6 +106,9 @@ wx sessions
|
||||
# 有未读消息的会话
|
||||
wx unread
|
||||
|
||||
# 只看真人(私聊 + 群聊)的未读,过滤公众号与折叠入口
|
||||
wx unread --filter private,group
|
||||
|
||||
# 上次检查后的新消息(增量)
|
||||
wx new-messages
|
||||
wx new-messages --json # JSON 输出,适合 agent 解析
|
||||
@@ -119,6 +122,17 @@ wx search "关键词"
|
||||
wx search "会议" --in "工作群" --since 2026-01-01
|
||||
```
|
||||
|
||||
`sessions` / `unread` / `history` / `new-messages` / `stats` 的输出都带 `chat_type` 字段,agent 可据此分流:
|
||||
|
||||
| 取值 | 含义 | username 特征 |
|
||||
|------|------|--------------|
|
||||
| `private` | 真人私聊 | `wxid_*` 或自定义短号 |
|
||||
| `group` | 群聊 | `*@chatroom` |
|
||||
| `official_account` | 公众号 / 订阅号 / 服务号 / 系统通知 | `gh_*`、`biz_*`、`mphelper`、`qqsafe`、`@opencustomerservicemsg` |
|
||||
| `folded` | 折叠入口(订阅号折叠、折叠群聊的聚合条目) | `brandsessionholder`、`@placeholder_foldgroup` |
|
||||
|
||||
`wx unread --filter` 支持 `private` / `group` / `official` / `folded` / `all`,逗号分隔多选。默认 `all`。
|
||||
|
||||
### 联系人与群组
|
||||
|
||||
```bash
|
||||
|
||||
Reference in New Issue
Block a user