docs: 修正文档与代码实现一致,添加 model 参数描述,区分源码/打包运行模式

This commit is contained in:
root
2026-04-14 12:00:57 +08:00
parent 974b92fc45
commit 9873d91224
3 changed files with 34 additions and 10 deletions

View File

@ -99,7 +99,7 @@ TrulyMEM-TrueHumanMEM/
│ ├── app.py # 主应用
│ ├── widgets/ # UI 组件
│ └── models/ # 数据模型
└── tests/ # 测试 (37 tests)
└── tests/ # 测试 (42 tests)
```
### 启动流程
@ -172,7 +172,7 @@ result = client.process_message("hello")
pytest tests/
```
37 个测试用例覆盖:
42 个测试用例覆盖:
- 数据包协议
- 后端初始化/启动/关闭
- 客户端方法

View File

@ -191,7 +191,8 @@ body = {} # 无参数
```python
body = {
"api_key": str, # API Key
"base_url": str # API Base URL (默认: https://api.deepseek.com)
"base_url": str, # API Base URL (默认: https://api.deepseek.com)
"model": str # 模型名称 (默认: deepseek-chat)
}
```
@ -206,7 +207,8 @@ body = {
```python
result = client.update_config(
api_key="sk-xxxxx",
base_url="https://api.deepseek.com"
base_url="https://api.deepseek.com",
model="deepseek-chat"
)
```
@ -276,15 +278,25 @@ body = {} # 无参数
from core import BackendServer, BackendClient
# 1. 创建并启动后端
server = BackendServer(db_path="graph_memory.db", use_embedded_db=True)
server.start(api_key="your-api-key", base_url="https://api.deepseek.com")
# config_file 默认: ~/.trulymem/config.json
server = BackendServer(
db_path="graph_memory.db",
use_embedded_db=True,
config_file=None # 可选,自定义配置路径
)
server.start(
api_key="your-api-key",
base_url="https://api.deepseek.com",
model="deepseek-chat" # 可选,模型名称
)
# 2. 创建客户端
client = BackendClient(server)
# 3. 发送消息
result = client.process_message("你好")
print(result["content"])
if result.get("success"):
print(result["content"])
# 4. 关闭
client.shutdown()
@ -296,8 +308,8 @@ client.shutdown()
import queue
from core import BackendServer, Packet, PacketType
server = BackendServer()
server.start(api_key="your-key")
server = BackendServer(config_file=None)
server.start(api_key="your-key", model="deepseek-chat")
# 创建请求包
response_queue = queue.Queue()

View File

@ -52,12 +52,24 @@ TrulyMEM.exe
## 数据存储
### 源码运行模式
| 数据 | 位置 |
|------|------|
| 图数据库 | `graph_memory.db`(应用目录) |
| 图数据库 | 项目目录 `graph_memory.db` |
| 配置文件 | 项目目录 `config.json`(如存在) |
| 数据库格式 | SQLite |
### 打包运行模式
| 数据 | 位置 |
|------|------|
| 图数据库 | `~/.trulymem/graph_memory.db` |
| 配置文件 | `~/.trulymem/config.json` |
| 数据库格式 | SQLite |
> **说明**:后端统一管理配置。前端仅负责消息展示,配置修改通过后端持久化到文件系统。
## 架构说明
### 通信协议