refactor: 工具调用限制全部移入 config.json,代码零硬编码

- 删除 server.py BackendServer.__init__ 中 _tool_limits 的硬编码字典
- _load_config 从 ~/.trulymem/config.json 读取全部限制值
- 首次启动无配置文件时自动生成带默认值的 config.json
- _create_tool_limiter 直接索引 _tool_limits 字典,无硬编码兜底
- 如需修改限制值,编辑 ~/.trulymem/config.json 即可生效(下次重启)
This commit is contained in:
root
2026-04-28 20:30:24 +08:00
parent 039dc41c0b
commit 3de418b7e8
2 changed files with 41 additions and 17 deletions

View File

@ -7,7 +7,10 @@ from dataclasses import dataclass
@dataclass
class ToolLimits:
"""工具调用限制配置"""
"""工具调用限制配置
实际值由 server.py 从 config.json 加载后传入,此处默认值仅作安全兜底。
如需修改限制,请编辑 ~/.trulymem/config.json。
"""
persona_update_max: int = 1
task_update_max: int = 20 # 工作记忆链修改create/set_state/delete/link_info
task_query_max: int = 30 # 工作记忆链查询memory_recall 查任务相关)