From 9873d912245aaf984280baeff306a2548347a9ed Mon Sep 17 00:00:00 2001 From: root Date: Tue, 14 Apr 2026 12:00:57 +0800 Subject: [PATCH] =?UTF-8?q?docs:=20=E4=BF=AE=E6=AD=A3=E6=96=87=E6=A1=A3?= =?UTF-8?q?=E4=B8=8E=E4=BB=A3=E7=A0=81=E5=AE=9E=E7=8E=B0=E4=B8=80=E8=87=B4?= =?UTF-8?q?=EF=BC=8C=E6=B7=BB=E5=8A=A0=20model=20=E5=8F=82=E6=95=B0?= =?UTF-8?q?=E6=8F=8F=E8=BF=B0=EF=BC=8C=E5=8C=BA=E5=88=86=E6=BA=90=E7=A0=81?= =?UTF-8?q?/=E6=89=93=E5=8C=85=E8=BF=90=E8=A1=8C=E6=A8=A1=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 4 ++-- docs/api.md | 26 +++++++++++++++++++------- docs/一键启动指南.md | 14 +++++++++++++- 3 files changed, 34 insertions(+), 10 deletions(-) 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 | +> **说明**:后端统一管理配置。前端仅负责消息展示,配置修改通过后端持久化到文件系统。 + ## 架构说明 ### 通信协议