refactor: restructure to core/ + ui/ with multi-threaded backend
This commit is contained in:
85
README.md
85
README.md
@ -33,8 +33,6 @@ TrulyMEM (TrueHumanMEM) 是一个让 AI 拥有长期记忆能力的图记忆系
|
||||
|
||||
### 方式一:打包后的可执行文件
|
||||
|
||||
打包后会生成独立可执行文件,可直接运行:
|
||||
|
||||
```bash
|
||||
# Windows: TrulyMEM.exe
|
||||
# Linux/macOS: TrulyMEM
|
||||
@ -45,14 +43,11 @@ chmod +x TrulyMEM
|
||||
### 方式二:从源码运行
|
||||
|
||||
```bash
|
||||
# 克隆仓库
|
||||
git clone <repo-url>
|
||||
cd TrulyMEM-TrueHumanMEM
|
||||
|
||||
# 安装依赖
|
||||
pip install -r requirements.txt
|
||||
|
||||
# 运行应用
|
||||
python trulymem_entry.py
|
||||
```
|
||||
|
||||
@ -111,25 +106,27 @@ python trulymem_entry.py
|
||||
|
||||
```
|
||||
TrulyMEM-TrueHumanMEM/
|
||||
├── trulymem_entry.py # 打包入口
|
||||
├── graph_memory_tui/ # 核心应用
|
||||
│ ├── app.py # TUI 主应用
|
||||
│ ├── main.py # 模块入口
|
||||
│ ├── core/ # 核心逻辑
|
||||
│ │ ├── embedded_db.py # SQLite 图数据库
|
||||
│ │ ├── graph_client.py # Neo4j 客户端(可选)
|
||||
│ │ ├── imports.py # 动态导入
|
||||
│ │ ├── prompts/ # 提示词管理
|
||||
│ │ └── tools/ # 工具定义
|
||||
│ ├── models/ # 数据模型
|
||||
│ ├── services/ # 服务层
|
||||
│ ├── handlers/ # 事件处理
|
||||
│ ├── widgets/ # TUI 组件
|
||||
│ └── styles/ # 样式文件
|
||||
├── tests/ # 测试
|
||||
├── docs/ # 文档
|
||||
├── requirements.txt # 依赖清单
|
||||
└── LICENSE # 许可证
|
||||
├── trulymem_entry.py # 入口:先启动 core → 再启动 ui
|
||||
├── core/ # 后端/业务逻辑
|
||||
│ ├── __init__.py
|
||||
│ ├── server.py # BackendServer (多线程)
|
||||
│ ├── client.py # BackendClient
|
||||
│ ├── embedded_db.py # SQLite 图数据库
|
||||
│ ├── graph_client.py
|
||||
│ ├── tool_executor.py
|
||||
│ ├── tool_limiter.py
|
||||
│ ├── memory_tools.py
|
||||
│ ├── prompts/
|
||||
│ └── tools/ # TOOLS 定义
|
||||
├── ui/ # TUI 显示层
|
||||
│ ├── __init__.py
|
||||
│ ├── app.py
|
||||
│ ├── widgets/
|
||||
│ ├── handlers/
|
||||
│ ├── models/
|
||||
│ ├── services/
|
||||
│ └── styles/
|
||||
└── tests/ # 测试 (38 tests)
|
||||
```
|
||||
|
||||
---
|
||||
@ -143,36 +140,38 @@ TrulyMEM-TrueHumanMEM/
|
||||
|
||||
---
|
||||
|
||||
## 架构说明
|
||||
|
||||
### TUI 与后端通信
|
||||
|
||||
```
|
||||
trulymem_entry.py
|
||||
│
|
||||
├─ 1. BackendServer.start() → 启动独立线程
|
||||
│
|
||||
├─ 2. GraphMemoryApp(backend_server=server)
|
||||
│
|
||||
└─ 3. BackendClient ← Queue → BackendServer
|
||||
```
|
||||
|
||||
- **core/** - 业务逻辑(数据库、API调用、工具执行)
|
||||
- **ui/** - 显示逻辑(Textual 组件)
|
||||
- 多线程 Queue 通信解耦
|
||||
|
||||
---
|
||||
|
||||
## 开发指南
|
||||
|
||||
### 环境设置
|
||||
|
||||
```bash
|
||||
# 创建虚拟环境
|
||||
python -m venv venv
|
||||
source venv/bin/activate # Linux/macOS
|
||||
venv\Scripts\activate # Windows
|
||||
|
||||
# 安装依赖
|
||||
pip install -r requirements.txt
|
||||
```
|
||||
|
||||
### 运行测试
|
||||
|
||||
```bash
|
||||
pytest tests/
|
||||
```
|
||||
|
||||
### 打包应用
|
||||
|
||||
```bash
|
||||
# Windows
|
||||
bash build/build_windows.bat
|
||||
|
||||
# Linux
|
||||
bash build/build_linux.sh
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 许可证
|
||||
@ -207,4 +206,4 @@ bash build/build_linux.sh
|
||||
|
||||
- [架构设计](docs/架构.md) - 系统架构和技术设计
|
||||
- [快速开始](docs/一键启动指南.md) - 启动指南
|
||||
- [工作记忆链机制说明](docs/工作记忆链机制说明.md) - 连续性任务处理
|
||||
- [工作记忆链机制说明](docs/工作记忆链机制说明.md) - 连续性任务处理
|
||||
Reference in New Issue
Block a user