diff --git a/README.md b/README.md index 82b1fca..65b9975 100644 --- a/README.md +++ b/README.md @@ -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 个测试用例覆盖: - 数据包协议 - 后端初始化/启动/关闭 - 客户端方法 diff --git a/docs/api.md b/docs/api.md index 5967144..41dd4c8 100644 --- a/docs/api.md +++ b/docs/api.md @@ -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() diff --git a/docs/一键启动指南.md b/docs/一键启动指南.md index 37fa885..49292f7 100644 --- a/docs/一键启动指南.md +++ b/docs/一键启动指南.md @@ -52,12 +52,24 @@ TrulyMEM.exe ## 数据存储 +### 源码运行模式 + | 数据 | 位置 | |------|------| -| 图数据库 | `graph_memory.db`(应用目录) | +| 图数据库 | 项目目录 `graph_memory.db` | +| 配置文件 | 项目目录 `config.json`(如存在) | +| 数据库格式 | SQLite | + +### 打包运行模式 + +| 数据 | 位置 | +|------|------| +| 图数据库 | `~/.trulymem/graph_memory.db` | | 配置文件 | `~/.trulymem/config.json` | | 数据库格式 | SQLite | +> **说明**:后端统一管理配置。前端仅负责消息展示,配置修改通过后端持久化到文件系统。 + ## 架构说明 ### 通信协议