1. Web 服务改为 threading 模式: - 新增 run_web_server(port) / stop_web_server() 函数 - TUI 通过 from web_api import run_web_server 直接调用 - 使用 werkzeug make_server 实现线程内优雅启动/停止 2. 构建脚本精简为单二进制: - 移除 trulymem-web 独立打包步骤 - 添加 werkzeug 到 hidden-imports 3. 详细启动文档移到 docs/zh/quick_start.md 4. README 精简为概述,指向 docs/ 目录
4.5 KiB
TrulyMEM Quick Start Guide
Version: Multi-user (v2) — TUI login, user isolation, embedded Web server
Running
Quick Start
# From source
python trulymem_entry.py
# Packaged binary
./dist/TrulyMEM
First Run — Login Flow
On first launch, TrulyMEM checks for legacy data and presents a login screen:
- Clean install → Enter username/password (first user becomes admin)
- Legacy upgrade → Detects
~/.trulymem/config.json, guides migration setup - Returning user → Login directly
💡 All user data is isolated:
~/.trulymem/{username}/
Chat Configuration
After login, press F2 to open the right-side configuration panel:
- API Key — Required (DeepSeek, OpenAI, etc.)
- Model — Optional
- Base URL — Optional
Config saves automatically.
Web Visualization
The Web service now runs embedded in the main process (no separate subprocess needed).
Start via TUI (Admin only)
Admin users: press F2 → check "Enable Web Service".
Start Manually
python web_api.py --port 4096
# Visit http://localhost:4096
First Visit Flow
- Open
http://localhost:4096in browser - No users → Auto-redirect to setup page, create admin account
- Has users → Login page
- After login → Star map visualization
Web Features
| Page | Access | Feature |
|---|---|---|
| 🌟 Star Map | All logged-in | Browse knowledge graph |
| ⚙ Settings | All logged-in | Change password |
| 🧑💼 User Management | Admin only | Add/delete users |
Multi-User System
Directory Layout
~/.trulymem/
├── trulymem.db # Global user database (web_users table)
├── .migrated # Migration flag
├── admin/
│ ├── config.json # Admin config
│ └── admin_graph.db # Admin knowledge graph
└── user2/
├── config.json # user2 config
└── user2_graph.db # user2 knowledge graph
Role Matrix
| Feature | User | Admin |
|---|---|---|
| Change password | ✅ | ✅ |
| Configure API Key / Model | ✅ | ✅ |
| Web service toggle (TUI) | ❌ | ✅ |
| Web login credentials | ❌ | ✅ |
| View user list | ❌ | ✅ |
| Add/delete users | ❌ | ✅ |
⚠️ First registered user becomes admin automatically. Add users via Web settings page.
Keyboard Shortcuts
| Key | Action |
|---|---|
| F1 | Help |
| F2 | Toggle sidebar (config panel) |
| F3 | Tool details |
| F5 | Clear screen |
| F6 | Quit |
Building
# Linux
bash build/build_linux.sh
# macOS
bash build/build_macos.sh
# Windows
build\build_windows.bat
# AppImage
bash build/build_appimage.sh
Output: dist/TrulyMEM (single binary — TUI and Web server embedded)
📦 Since v2, the Web server runs as a thread inside the main process. No need for a separate
trulymem-webbinary.
Architecture
Communication
TUI (Textual) ←→ BackendClient ←→ queue.Queue ←→ BackendServer (thread)
Config Management
- Per-user:
~/.trulymem/{username}/config.json - Web config:
~/.trulymem/trulymem.db(web_users table) - Auto-load: reads config for logged-in user on startup
- Persistent: saves automatically on change
Web Service Architecture
┌──────────────────────┐
│ TrulyMEM Process │
│ ┌──────┐ ┌────────┐ │
│ │ TUI │ │ Flask │ │ ← Same process, different threads
│ │ │ │ Thread │ │
│ └──────┘ └────────┘ │
└──────────────────────┘
FAQ
Python not found
Install Python 3.8+: https://www.python.org/downloads/
Dependency installation fails
python -m venv venv
source venv/bin/activate # Linux/macOS
venv\Scripts\activate # Windows
pip install -r requirements.txt
Invalid API Key
Check format and whitespace. Reconfigure in TUI sidebar.
Lost admin account
The first registered user is always admin. If all users lost admin, delete trulymem.db from the user directory and re-register.
Legacy data migration
When old ~/.trulymem/config.json and graph_memory.db are detected, TUI auto-enters migration flow. Legacy files are preserved.
Dev Commands
pip install -r requirements.txt
pytest tests/
bash build/build_linux.sh