Skip to content

A Local-first chat analysis tool: Relive your social memories powered by SQL and AI Agents. 本地化的聊天记录分析工具,通过 SQL 和 AI Agent 回顾你的社交记忆。

License

Notifications You must be signed in to change notification settings

hellodigua/ChatLab

Repository files navigation

ChatLab

Local-first chat analysis tool: Relive your social memories powered by SQL and AI Agents.

English | 简体中文

Project Website · Documentation · Roadmap · Issue Submission

ChatLab is a free, open-source, and local-first application dedicated to analyzing chat records. Through an AI Agent and a flexible SQL engine, you can freely dissect, query, and even reconstruct your social data.

We refuse to upload your privacy to the cloud; instead, we bring powerful analytics directly to your computer.

Currently supported: Chat record analysis for LINE, WeChat, QQ, WhatsApp, Instagram and Discord. Upcoming support: Messenger, iMessage.

The project is still in early iteration, so there are many bugs and unfinished features. If you encounter any issues, feel free to provide feedback.

Core Features

  • 🚀 Ultimate Performance: Utilizing stream computing and multi-threaded parallel architecture, it maintains fluid interaction and response even with millions of chat records.
  • 🔒 Privacy Protection: Chat records and configurations are stored in your local database, and all analysis is performed locally (with the exception of AI features).
  • 🤖 Intelligent AI Agent: Integrated with 10+ Function Calling tools and supporting dynamic scheduling to deeply excavate interesting insights from chat records.
  • 📊 Multi-dimensional Data Visualization: Provides intuitive analysis charts for activity trends, time distribution patterns, member rankings, and more.
  • 🧩 Format Standardization: Through a powerful data abstraction layer, it bridges the format differences between various chat applications, allowing any chat records to be analyzed.

Usage Guides

Preview Interface

For more previews, please visit the official website: chatlab.fun

Preview Interface

System Architecture

Electron Main Process

  • electron/main/index.ts handles the application lifecycle, window management, and custom protocol registration.
  • electron/main/ipc/ splits IPC modules by function (Window, Chat, Merge, AI, Cache) to ensure secure and controllable data exchange.
  • electron/main/ai/ integrates multiple LLMs, featuring built-in Agent pipelines, prompt assembly, and Function Calling tool registration.

Worker and Data Pipeline

  • The workerManager in electron/main/worker/ coordinates Worker threads, while dbWorker handles message routing.
  • worker/query/* handles activity, AI search, advanced analysis, and SQL Lab queries.
  • worker/import/streamImport.ts provides stream importing.
  • The parser/ directory adopts a three-layer "sniff + parse" architecture capable of processing GB-level log files with constant memory usage.

Rendering Process

  • Vue 3 + Nuxt UI + Tailwind CSS manages the visualization pages.
  • src/pages contains business pages, while src/components/analysis and src/components/charts provide reusable components.
  • src/stores manages states like sessions, layout, and AI prompts via Pinia.
  • src/composables/useAIChat.ts encapsulates the AI conversation workflow.
  • The preload script electron/preload/index.ts exposes window.chatApi/mergeApi/aiApi/llmApi, ensuring secure isolation between the renderer and main processes.

Local Development

Setup Steps

Node.js environment requirement: v20+

# Install dependencies
pnpm install

# Start development server
pnpm run dev

If Electron encounters exceptions during startup, you can try using electron-fix:

npm install electron-fix -g
electron-fix start

Contribution Guide

Please follow these principles before submitting a Pull Request:

  • Obvious bug fixes can be submitted directly.
  • For new features, please submit an Issue for discussion first; PRs submitted without prior discussion will be closed.
  • Keep one PR focused on one task; if changes are extensive, consider splitting them into multiple independent PRs.

Privacy Policy & User Agreement

Before using this software, please read the Privacy Policy & User Agreement.

License

AGPL-3.0 License

About

A Local-first chat analysis tool: Relive your social memories powered by SQL and AI Agents. 本地化的聊天记录分析工具,通过 SQL 和 AI Agent 回顾你的社交记忆。

Topics

Resources

License

Stars

Watchers

Forks

Contributors 4

  •  
  •  
  •  
  •  

Languages