mirror of
https://gitcode.com/JianFeeeee/TrulyMEM-TrueHumanMEM.git
synced 2026-09-20 08:58:15 +00:00
docs: fix garbled text, sync architecture with code, add tool limits API
This commit is contained in:
@ -27,6 +27,8 @@ class PacketType(Enum):
|
|||||||
GET_STATUS = "get_status" # Get status
|
GET_STATUS = "get_status" # Get status
|
||||||
GET_CONFIG = "get_config" # Get config
|
GET_CONFIG = "get_config" # Get config
|
||||||
SET_CONFIG = "set_config" # Set config
|
SET_CONFIG = "set_config" # Set config
|
||||||
|
GET_TOOL_LIMITS = "get_tool_limits" # Get tool limits
|
||||||
|
SET_TOOL_LIMITS = "set_tool_limits" # Set tool limits
|
||||||
GET_HISTORY = "get_history" # Get history
|
GET_HISTORY = "get_history" # Get history
|
||||||
SAVE_HISTORY = "save_history" # Save history
|
SAVE_HISTORY = "save_history" # Save history
|
||||||
SHUTDOWN = "shutdown" # Shutdown service
|
SHUTDOWN = "shutdown" # Shutdown service
|
||||||
@ -199,7 +201,71 @@ body = {
|
|||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
### 6. GET_HISTORY - Get Message History
|
### 6. GET_TOOL_LIMITS - Get Tool Limits
|
||||||
|
|
||||||
|
Get current AI reasoning tool call limits.
|
||||||
|
|
||||||
|
**Request Parameters:**
|
||||||
|
```python
|
||||||
|
body = {} # No parameters
|
||||||
|
```
|
||||||
|
|
||||||
|
**Response Data:**
|
||||||
|
```python
|
||||||
|
{
|
||||||
|
"persona_query_max": int, # Persona graph query limit
|
||||||
|
"persona_update_max": int, # Persona graph update limit
|
||||||
|
"task_query_max": int, # Working memory query limit
|
||||||
|
"task_update_max": int, # Working memory update limit
|
||||||
|
"memory_query_max": int, # General memory query limit
|
||||||
|
"memory_update_max": int # General memory update limit
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
**Example:**
|
||||||
|
```python
|
||||||
|
result = client.get_tool_limits()
|
||||||
|
print(result["data"]["persona_query_max"]) # 1
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### 7. SET_TOOL_LIMITS - Set Tool Limits
|
||||||
|
|
||||||
|
Set AI reasoning tool call limits.
|
||||||
|
|
||||||
|
**Request Parameters:**
|
||||||
|
```python
|
||||||
|
body = {
|
||||||
|
"persona_query_max": int, # Persona query limit (≥1)
|
||||||
|
"persona_update_max": int, # Persona update limit (≥1)
|
||||||
|
"task_query_max": int, # Working memory query limit (≥1)
|
||||||
|
"task_update_max": int, # Working memory update limit (≥1)
|
||||||
|
"memory_query_max": int, # General memory query limit (≥1)
|
||||||
|
"memory_update_max": int # General memory update limit (≥1)
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
**Response Data:**
|
||||||
|
```python
|
||||||
|
{
|
||||||
|
"status": "tool_limits_updated",
|
||||||
|
"limits": {...} # Updated limits
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
**Example:**
|
||||||
|
```python
|
||||||
|
result = client.update_tool_limits(
|
||||||
|
persona_query_max=2,
|
||||||
|
task_query_max=5,
|
||||||
|
memory_query_max=30
|
||||||
|
)
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### 8. GET_HISTORY - Get Message History
|
||||||
|
|
||||||
Get saved message history.
|
Get saved message history.
|
||||||
|
|
||||||
|
|||||||
@ -17,21 +17,20 @@ TrulyMEM-TrueHumanMEM/
|
|||||||
│ ├── __init__.py # Export BackendServer, BackendClient, EmbeddedGraphDB
|
│ ├── __init__.py # Export BackendServer, BackendClient, EmbeddedGraphDB
|
||||||
│ ├── server.py # BackendServer (Packet communication protocol)
|
│ ├── server.py # BackendServer (Packet communication protocol)
|
||||||
│ ├── client.py # BackendClient (Packet protocol client)
|
│ ├── client.py # BackendClient (Packet protocol client)
|
||||||
│ ├── embedded_db.py # SQLite graph database implementation
|
│ ├── embedded_db.py # SQLite graph database implementation
|
||||||
│ ├── graph_client.py # OpenAI/DeepSeek API client
|
│ ├── graph_client.py # OpenAI/DeepSeek API client
|
||||||
│ ├── tool_executor.py # Tool executor
|
│ ├── tool_executor.py # Tool executor
|
||||||
│ ├── tool_limiter.py # Tool call limiter
|
│ ├── tool_limiter.py # Tool call limiter
|
||||||
│ ├── tools/ # Tool definitions
|
│ ├── tools/ # Tool definitions
|
||||||
│ │ ├── __init__.py
|
|
||||||
│ │ └── memory_tools.py
|
│ │ └── memory_tools.py
|
||||||
│ └── prompts/ # Prompt management
|
│ └── prompts/ # Prompt management
|
||||||
├── ui/ # TUI display layer (display only, no AI logic)
|
├── ui/ # TUI display layer (display only, no AI logic)
|
||||||
│ ├── __init__.py # Export GraphMemoryApp, AppConfig
|
│ ├── __init__.py # Export GraphMemoryApp
|
||||||
│ ├── app.py # GraphMemoryApp (communicates via BackendClient)
|
│ ├── app.py # GraphMemoryApp (communicates via BackendClient)
|
||||||
│ ├── widgets/ # TUI components
|
│ ├── widgets/ # TUI components
|
||||||
│ ├── handlers/ # Event handlers
|
|
||||||
│ ├── models/ # Data models
|
│ ├── models/ # Data models
|
||||||
│ ├── services/ # Service layer (config only)
|
│ ├── services/ # Service layer (config only)
|
||||||
|
│ ├── handlers/ # Event handlers
|
||||||
│ └── styles/ # Style files
|
│ └── styles/ # Style files
|
||||||
└── tests/ # Tests (42 tests)
|
└── tests/ # Tests (42 tests)
|
||||||
```
|
```
|
||||||
|
|||||||
@ -27,6 +27,8 @@ class PacketType(Enum):
|
|||||||
GET_STATUS = "get_status" # 获取状态
|
GET_STATUS = "get_status" # 获取状态
|
||||||
GET_CONFIG = "get_config" # 获取配置
|
GET_CONFIG = "get_config" # 获取配置
|
||||||
SET_CONFIG = "set_config" # 设置配置
|
SET_CONFIG = "set_config" # 设置配置
|
||||||
|
GET_TOOL_LIMITS = "get_tool_limits" # 获取工具限制
|
||||||
|
SET_TOOL_LIMITS = "set_tool_limits" # 设置工具限制
|
||||||
GET_HISTORY = "get_history" # 获取历史
|
GET_HISTORY = "get_history" # 获取历史
|
||||||
SAVE_HISTORY = "save_history" # 保存历史
|
SAVE_HISTORY = "save_history" # 保存历史
|
||||||
SHUTDOWN = "shutdown" # 关闭服务
|
SHUTDOWN = "shutdown" # 关闭服务
|
||||||
@ -214,7 +216,71 @@ result = client.update_config(
|
|||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
### 6. GET_HISTORY - 获取消息历史
|
### 6. GET_TOOL_LIMITS - 获取工具限制
|
||||||
|
|
||||||
|
获取当前 AI 推理时的工具调用限制配置。
|
||||||
|
|
||||||
|
**请求参数:**
|
||||||
|
```python
|
||||||
|
body = {} # 无参数
|
||||||
|
```
|
||||||
|
|
||||||
|
**响应数据:**
|
||||||
|
```python
|
||||||
|
{
|
||||||
|
"persona_query_max": int, # 人设图查询上限
|
||||||
|
"persona_update_max": int, # 人设图修改上限
|
||||||
|
"task_query_max": int, # 工作记忆查询上限
|
||||||
|
"task_update_max": int, # 工作记忆修改上限
|
||||||
|
"memory_query_max": int, # 一般记忆查询上限
|
||||||
|
"memory_update_max": int # 一般记忆修改上限
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
**示例:**
|
||||||
|
```python
|
||||||
|
result = client.get_tool_limits()
|
||||||
|
print(result["data"]["persona_query_max"]) # 1
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### 7. SET_TOOL_LIMITS - 设置工具限制
|
||||||
|
|
||||||
|
设置 AI 推理时的工具调用限制。
|
||||||
|
|
||||||
|
**请求参数:**
|
||||||
|
```python
|
||||||
|
body = {
|
||||||
|
"persona_query_max": int, # 人设图查询上限 (≥1)
|
||||||
|
"persona_update_max": int, # 人设图修改上限 (≥1)
|
||||||
|
"task_query_max": int, # 工作记忆查询上限 (≥1)
|
||||||
|
"task_update_max": int, # 工作记忆修改上限 (≥1)
|
||||||
|
"memory_query_max": int, # 一般记忆查询上限 (≥1)
|
||||||
|
"memory_update_max": int # 一般记忆修改上限 (≥1)
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
**响应数据:**
|
||||||
|
```python
|
||||||
|
{
|
||||||
|
"status": "tool_limits_updated",
|
||||||
|
"limits": {...} # 更新后的限制
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
**示例:**
|
||||||
|
```python
|
||||||
|
result = client.update_tool_limits(
|
||||||
|
persona_query_max=2,
|
||||||
|
task_query_max=5,
|
||||||
|
memory_query_max=30
|
||||||
|
)
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### 8. GET_HISTORY - 获取消息历史
|
||||||
|
|
||||||
获取保存的消息历史。
|
获取保存的消息历史。
|
||||||
|
|
||||||
|
|||||||
@ -17,21 +17,20 @@ TrulyMEM-TrueHumanMEM/
|
|||||||
│ ├── __init__.py # 导出 BackendServer, BackendClient, EmbeddedGraphDB
|
│ ├── __init__.py # 导出 BackendServer, BackendClient, EmbeddedGraphDB
|
||||||
│ ├── server.py # BackendServer (Packet 通信协议)
|
│ ├── server.py # BackendServer (Packet 通信协议)
|
||||||
│ ├── client.py # BackendClient (Packet 协议客户端)
|
│ ├── client.py # BackendClient (Packet 协议客户端)
|
||||||
│ ├── embedded_db.py # SQLite 图数据库实现
|
│ ├── embedded_db.py # SQLite 图数据库实现
|
||||||
│ ├── graph_client.py # OpenAI/DeepSeek API 客户端
|
│ ├── graph_client.py # OpenAI/DeepSeek API 客户端
|
||||||
│ ├── tool_executor.py # 工具执行器
|
│ ├── tool_executor.py # 工具执行器
|
||||||
│ ├── tool_limiter.py # 工具调用限制器
|
│ ├── tool_limiter.py # 工具调用限制器
|
||||||
│ ├── tools/ # 工具定义
|
│ ├── tools/ # 工具定义
|
||||||
│ │ ├── __init__.py
|
|
||||||
│ │ └── memory_tools.py
|
│ │ └── memory_tools.py
|
||||||
│ └── prompts/ # 提示词管理
|
│ └── prompts/ # 提示词管理
|
||||||
├── ui/ # TUI 显示层(仅显示,无 AI 逻辑)
|
├── ui/ # TUI 显示层(仅显示,无 AI 逻辑)
|
||||||
│ ├── __init__.py # 导出 GraphMemoryApp, AppConfig
|
│ ├── __init__.py # 导出 GraphMemoryApp
|
||||||
│ ├── app.py # GraphMemoryApp (通过 BackendClient 通信)
|
│ ├── app.py # GraphMemoryApp (通过 BackendClient 通信)
|
||||||
│ ├── widgets/ # TUI 组件
|
│ ├── widgets/ # TUI 组件
|
||||||
│ ├── handlers/ # 事件处理
|
|
||||||
│ ├── models/ # 数据模型
|
│ ├── models/ # 数据模型
|
||||||
│ ├── services/ # 服务层(仅配置管理)
|
│ ├── services/ # 服务层(仅配置管理)
|
||||||
|
│ ├── handlers/ # 事件处理
|
||||||
│ └── styles/ # 样式文件
|
│ └── styles/ # 样式文件
|
||||||
└── tests/ # 测试 (42 tests)
|
└── tests/ # 测试 (42 tests)
|
||||||
```
|
```
|
||||||
|
|||||||
@ -133,7 +133,7 @@ task_create(
|
|||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## 必须查<EFBFBD><EFBFBD><EFBFBD>工作记忆链的场景
|
## 必须查询工作记忆链的场景
|
||||||
|
|
||||||
### 强制查询场景
|
### 强制查询场景
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user