Feature/97 add tool call summary results table / 添加工具调用摘要结果表#107
Merged
Feature/97 add tool call summary results table / 添加工具调用摘要结果表#107
Conversation
- 新增功能: 实现工具调用结果的持久化存储与检索 * 新增 `tool_call_summaries` 表结构,包含 session_id, func_name, kwargs_json, result, timestamp 字段及联合主键 * 创建 `idx_tool_call_summaries_session` 索引以优化按会话查询性能 * 新增 `record_tool_call_summary` 方法,支持通过 ON CONFLICT DO UPDATE 策略更新重复调用的结果 * 新增 `get_tool_call_summaries` 方法,用于按时间倒序获取指定会话的所有工具调用摘要
- 新增功能: 实现工具调用后的摘要数据持久化 * 引入 `_record_tool_summary` 方法用于捕获 `func_name`, `kwargs` 及 `result` * 集成 `src.console.result_manager._to_string` 将结果转换为字符串格式 * 通过 `workspace.db.record_tool_call_summary` 将数据写入数据库,包含 `session_id` 和计算后的 `kwargs_json` - 重构优化: 增强工具执行流程的可观测性 * 在 `call_tool` 逻辑末尾增加摘要记录调用点,确保在压缩结果前完成数据收集 * 排除 `write`, `edit`, `confirm_edit` 等写操作工具,仅记录读/查询类工具的摘要信息
- 新增功能: 验证 `tool_call_summaries` 表的数据库操作逻辑 * 测试 `record_tool_call_summary` 方法在相同主键下的更新行为及时间戳刷新机制 * 验证不同 `func_name` 和 `kwargs_json` 参数组合下生成独立记录的正确性 * 确认 `get_tool_call_summaries` 返回结果按时间戳排序且支持多会话隔离查询 * 检查外键约束 (FK) 防止无效 `session_id` 插入及索引 `idx_tool_call_summaries_session` 的存在性
- 修复问题: 修正 SQL 语句格式并统一测试中的异常类型断言 * 将 `CREATE INDEX` 语句合并为单行,移除多余换行符以符合代码风格 * 在 `test_tool_call_summaries.py` 中将通用的 `Exception` 替换为具体的 `sqlite3.IntegrityError` * 确保外键约束失败时能准确捕获 `IntegrityError` 而非泛型异常
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.