跳到正文
DEV Community· Om Gedam·· 3 小時前AI 評分44

ChatDigest:在本機通宵整理羣組聊天的 AI 智能體

ChatDigest: An Overnight Local Agent that Reads Group Chats While You Sleep

AI 導讀

ChatDigest 使用 Ollama 在本機離線執行 gemma3:4b,讀取 WhatsApp 羣組聊天匯出資料,並在每朝生成嚴格兩行摘要,交代聊天內容及待辦事項。它以 SQLite 去重訊息,透過兩階段 Map-Reduce 流程整理最近 12 小時的訊息,不使用雲端 API,推理成本為 $0.00。

正文

This is a submission for the Hacktoberfest Open-Source AI Challenge Week 3: Slow and Steady

What I Built

I built ChatDigest, an entirely local, privacy-first AI agent that reads exported WhatsApp group chats overnight and hands you a strict, two-line summary every morning.

It saves you from the exhausting task of scrolling through 100+ unread messages just to figure out what actually happened and what you need to do today. If you want to wake up, read exactly two sentences, and know if you need to reply to anyone, this app lets you be a little lazier.

Demo

Here is an example of what the agent generates and writes to my laptop's hard drive every morning at 7:00 AM:

=== Morning briefing (10 msgs, gemma3:4b) ===
Dinner time shifted to 7:30 PM for everyone.
Priya: Get the receipt, Arun: Provide deposit receipt now.

Code

GitHub logo itsomg134 / chat-digest

A local overnight group-chat summarizer powered by Gemma 3 and Ollama. Built for Hacktoberfest.

ChatDigest: Overnight Local Group-Chat Summarizer

ChatDigest is a fully local, privacy-first AI agent that reads your group chat exports while you sleep and hands you a strict, two-line summary every morning. No cloud APIs, no data leaks—just you, your laptop, and Google's Gemma running entirely offline.

Built for Hacktoberfest 2026.

Features

  • 100% Offline & Private: Uses Ollama to run gemma3:4b locally. Your sensitive group chats never leave your machine.
  • Two-Pass Map-Reduce Pipeline:
    1. Condense: Compresses large chat logs into terse bullet points (decisions, action items, deadlines).
    2. Finalize: Enforces a strict JSON output to generate exactly two lines—what happened, and what you need to do.
  • Deduplication Database: Uses SQLite to ingest WhatsApp .txt or .jsonl exports, ensuring you never process the same message twice.
  • Zero-Dependency Scheduler: Includes a lightweight Python scheduler that stays resident and fires the briefing at your chosen time (e.g., 07:00).

Quick Start

1. Prerequisites

How I Built It

ChatDigest is built in Python and relies entirely on open-source AI and local inference. The core of the project is Gemma (gemma3:4b), running locally via Ollama.

Here is the workflow:

Ingest: The script reads WhatsApp .txt exports from a local folder, parses the timestamps, and hashes them into a SQLite database so it never processes the same message twice.

Map-Reduce Pipeline: It grabs the last 12 hours of messages and uses Ollama to call Gemma. Pass 1 condenses the chunks into terse bullet points like action items, deadlines. Pass 2 feeds those bullets back to Gemma with a strict JSON prompt to generate the final two-line output.

Schedule: A lightweight Python script sleeps until 07:00 AM local time, fires the digest, saves it to a text file, and goes back to sleep.

Why Does Open Innovation Matter?

Open innovation was a hard requirement for this project, not just a preference.

  1. Absolute Data Privacy: Group chats contain highly sensitive personal data, addresses, and proprietary work decisions. Sending this to a closed cloud API is a massive privacy violation. Because I am running Gemma locally, the data never leaves my laptop. It is 100% offline.

  2. Zero Marginal Cost: Because inference runs locally on my machine, the cost is exactly $0.00. A closed API would charge me every single night to summarize hundreds of messages. Open weights let me run this automation infinitely without a monthly bill.

  3. The Freedom to Swap: Because Ollama acts as a standardized local runtime, I could easily swap from gemma3:1b for speed to gemma3:4b for better reasoning by changing a single line in my config.yaml. You cannot do that on a closed, hosted API.

  4. Offline Resilience: Sloths don't worry about internet outages. If my Wi-Fi goes down at 2:00 AM, ChatDigest doesn't care. The stack (Python + SQLite + Ollama + Gemma) is entirely self-contained

The Lazy Payoff

I set this up once. I never pay for it, I never worry about API rate limits, and I never have to scroll through hundreds of messages again. It is the ultimate "set it and forget it" automation. I wake up, read two lines, and get on with my day.

Prize Categories

Best Use of Gemma, The entire summarization logic from the chunking condensing to the strict JSON formatting is powered entirely by the open weight gemma3:4b model running locally via Ollama.

來源:DEV Community · dev.to