complete-digest-workflow.md 4.25 KB

Complete WeChat Group Digest Workflow

Overview

This document describes the complete end-to-end workflow for generating a WeChat group daily digest, from raw messages to delivered infographic.

Workflow Diagram

┌─────────────────┐     ┌──────────────────┐     ┌─────────────────┐
│  WeChat Messages │────▶│  Extract Content  │────▶│  Generate Report │
│  (EnMicroMsg.db) │     │  (Articles + Chat) │     │  (Markdown)      │
└─────────────────┘     └──────────────────┘     └─────────────────┘
                                                           │
                                                           ▼
┌─────────────────┐     ┌──────────────────┐     ┌─────────────────┐
│  Send to Group   │◀────│  Generate Image   │◀────│  Kimi Analysis   │
│  (ACTION_SEND)   │     │  (Infographic)    │     │  (Optional)      │
└─────────────────┘     └──────────────────┘     └─────────────────┘

Step-by-Step

1. Query Messages

SELECT msgId, type, isSend, talker, content, createTime 
FROM message 
WHERE talker = 'CHATROOM_ID@chatroom' 
AND createTime > TODAY_TIMESTAMP_MS 
ORDER BY createTime DESC

2. Extract Articles (Type 49)

Parse XML content for:

  • <title> - Article title
  • <des> - Article description
  • <url> - Article URL
  • <sourcedisplayname> - Source account

3. Extract Discussions (Type 1)

Group text messages by:

  • Time proximity (messages within 5 minutes)
  • Topic similarity
  • Participant overlap

4. Generate Complete Report

Use scripts/wechat_digest_generator.py:

python3 scripts/wechat_digest_generator.py \
  --group "8-TG0和朋友们的AGI" \
  --output /sdcard/WeChatDigest/ \
  --use-kimi

Report MUST include:

  • Every article: title + source + summary + keywords
  • Every discussion: topic + participants + key viewpoints
  • Statistics: article count, discussion count, active members
  • Technology trends summary

5. Optional: Kimi Deep Analysis

from kimi_client import simple_chat

analysis = simple_chat(f"""
Analyze these WeChat discussions:
{discussion_text}

Output:
1. Top 3 hot topics
2. Key viewpoints per topic
3. Technology trends (5 points)
4. What deserves attention
""", timeout=90)

6. Generate Infographic

Use v4 for complete reports or v5 for Kimi-designed layout:

# v4: Full article details with cards
python3 references/newspaper_infographic_v4.py \
  --report report_YYYYMMDD.md \
  --output infographic_v4.png

# v5: Kimi-designed professional layout
python3 references/newspaper_infographic_v5.py \
  --report report_YYYYMMDD.md \
  --output infographic_v5.png

7. Send to Group

# Trigger system share
am start -a android.intent.action.SEND -t image/png \
  --eu android.intent.extra.STREAM file:///sdcard/infographic.png

# Check screen state first!
# If screen is off, wake device before OCR

Key Files

File Purpose
scripts/wechat_digest_generator.py Full automation pipeline
references/newspaper_infographic_v4.py Infographic generator v4
references/newspaper_infographic_v5.py Infographic generator v5 (Kimi-designed)
../kimi-api/scripts/kimi_client.py Kimi API client for analysis

User Corrections Applied

  1. Complete information extraction: "把每一篇文章的标题和每一篇文章的概要全部都读出来"
  2. Chat discussion summarization: "把每一个人的这个聊天记录也要理解总结出来"
  3. Report-first workflow: "把这个文档扔给信息图的skill,让文档去基于这个文档去生成一个更好的信息图"
  4. Chinese-only requirement: "不要用英文" - all text must be Chinese
  5. Visual design: "太素了,不好看,配图太少" - v3/v4/v5 added cards, colors, icons, stats