你的“第二大脑”与智能助理。基于 RAG (检索增强生成) 技术,连接 Notion、本地文件与 LLM,帮助你管理知识、回答问题并执行任务。
- 📚 多源数据同步: 支持 Notion (增量同步) 和 本地文件 (Markdown/PDF) 的自动清洗与向量化。
- 🧠 智能问答 (RAG): 基于 Qdrant 向量数据库,提供精准的语义检索与问答。
- 🤖 意图路由 (Agentic Workflow): 使用 LangGraph 构建,自动识别用户意图(查资料、写周报、闲聊)并分发给不同的处理单元。
- ⚙️ 任务执行: 支持 Function Calling,可自动查询日历、整理周报并回写到 Notion。
- 💬 现代化 UI: 基于 Chainlit 构建,支持流式输出、中间步骤可视化 (Glass Box) 和引用源溯源。
- 🐳 一键部署: 提供 Docker Compose 配置,一键拉起所有服务。
本项目采用分层架构设计:
- 数据层: Notion / Local Files -> ETL (LlamaIndex) -> Qdrant (Vector DB)
- 推理层: LangGraph (Router Node -> RAG Node / Action Node)
- 交互层: Chainlit (Web UI)
确保本地已安装:
- Docker & Docker Compose
- Python 3.11+ (如果本地运行)
- OpenAI API Key (或兼容的 LLM Key)
- Notion Integration Token (如果需要同步 Notion)
复制 .env.example 为 .env 并填入你的 Key:
cp .env.example .env.env 内容示例:
OPENAI_API_KEY=sk-your-openai-key...
NOTION_INTEGRATION_TOKEN=secret_your-notion-token...
QDRANT_URL=http://qdrant:6333docker-compose up -d启动后访问: http://localhost:8000
如果你想修改代码进行调试:
# 1. 安装依赖
pip install -r requirements.txt
# 2. 启动 Qdrant (使用 Docker)
docker run -p 6333:6333 qdrant/qdrant
# 3. 运行数据同步 (可选)
python ingest.py
# 4. 启动 Chainlit 应用
chainlit run app.py -wpersonal_knowledge_base/
├── app.py # Chainlit 入口 (交互层)
├── logic.py # LangGraph 核心逻辑 (推理层)
├── ingest.py # 数据同步脚本 (Notion -> Qdrant)
├── notion_sync.py # Notion 全量同步逻辑
├── incremental_sync.py # Notion 增量同步逻辑
├── requirements.txt # Python 依赖
├── Dockerfile # 构建镜像
├── docker-compose.yml # 容器编排
└── .env # 环境变量
- LLM Framework: LlamaIndex (数据索引), LangGraph (Agent 控制流)
- Vector Database: Qdrant
- UI Framework: Chainlit
- LLM Provider: OpenAI (GPT-4o / GPT-3.5)
- Tools: Notion API, Google Calendar API (Optional)
欢迎提交 Issue 和 Pull Request 来改进这个“第二大脑”!
MIT