diff --git a/src/common/tool_history.py b/src/common/tool_history.py index 6a1414e9..778d93ec 100644 --- a/src/common/tool_history.py +++ b/src/common/tool_history.py @@ -54,7 +54,16 @@ class ToolHistoryManager: execution_time: float, status: str, chat_id: Optional[str] = None): - """记录工具调用""" + """记录工具调用 + + Args: + tool_name: 工具名称 + args: 工具调用参数 + result: 工具返回结果 + execution_time: 执行时间(秒) + status: 执行状态("completed"或"error") + chat_id: 聊天ID,与ChatManager中的chat_id对应,用于标识群聊或私聊会话 + """ # 检查是否启用历史记录 if not global_config.tool.history.enable_history: return @@ -136,14 +145,13 @@ class ToolHistoryManager: chat_id: Optional[str] = None, limit: Optional[int] = None, status: Optional[str] = None) -> List[Dict[str, Any]]: - """ - 查询工具调用历史 + """查询工具调用历史 Args: tool_names: 工具名称列表,为空则查询所有工具 start_time: 开始时间,可以是datetime对象或ISO格式字符串 end_time: 结束时间,可以是datetime对象或ISO格式字符串 - chat_id: 会话ID,用于筛选特定会话的调用 + chat_id: 聊天ID,与ChatManager中的chat_id对应,用于查询特定群聊或私聊的历史记录 limit: 返回记录数量限制 status: 执行状态筛选("completed"或"error") diff --git a/template/bot_config_template.toml b/template/bot_config_template.toml index 826af325..d43ece1c 100644 --- a/template/bot_config_template.toml +++ b/template/bot_config_template.toml @@ -1,5 +1,5 @@ [inner] -version = "6.4.6" +version = "6.4.7" #----以下是给开发人员阅读的,如果你只是部署了麦麦,不需要阅读---- #如果你想要修改配置文件,请递增version的值 @@ -114,6 +114,10 @@ ban_msgs_regex = [ [tool] enable_tool = false # 是否在普通聊天中启用工具 +[tool.history] +enable_history = true # 是否启用工具调用历史记录 +max_history = 5 # 每个会话最多保留的历史记录数 + [mood] enable_mood = true # 是否启用情绪系统 mood_update_threshold = 1 # 情绪更新阈值,越高,更新越慢