DeepSeek-Reasonix icon indicating copy to clipboard operation
DeepSeek-Reasonix copied to clipboard

feat: add search_sessions tool for cross-session keyword search

Open eghrhegpe opened this issue 5 months ago • 2 comments

search_sessions 工具

在保存的会话中按关键词搜索,返回匹配的会话文件名、时间戳和消息摘录。

功能

  • 大小写不敏感关键词搜索
  • 可选 model 参数过滤模型
  • max_results 上限 50,返回摘要(最多 3 条 excerpt/会话)
  • 自动跳过 cleanup-pending 会话
  • 排除 tool result(隐私安全)

修复

  • matchContent 中 byte offset 当 rune index 使用的 bug(含中文/emoji 时截取错误)
  • 正确使用 utf8.RuneCountInString 做 byte→rune 转换

测试

  • TestMatchContent_Ascii / _Chinese / _Emoji / _NoMatch / _Boundary / _QueryLength
  • TestSearchSession / _LimitExcerpts / _NoMatch

@past:chats 引用

  • SearchSessions API(bridge.ts + app.go)
  • SessionReference 类型

Cache-impact: low — 仅新增 tool 注册行和 session 搜索逻辑,不影响已有缓存前缀 Cache-guard: go test ./internal/tool/sessiontool/ -count=1 -run "TestMatchContent|TestSearchSession" System-prompt-review: n/a — 新工具不在系统提示词中

eghrhegpe avatar Jun 20 '26 02:06 eghrhegpe

拉取仓库后,AI好像没识别出如何解决此冲突。 运行指标 耗时 2分12秒 请求数 31 会话 tokens 6,314,916 成本 缓存命中

会话费用 ¥0.3291 主模型 ¥0.1605 9 次 规划器 ¥0.1686 22 次

eghrhegpe avatar Jun 20 '26 13:06 eghrhegpe

第二次运行指标 耗时 25分11秒 请求数 271 会话 tokens 124,170,366 成本 缓存命中

会话费用 ¥3.24 主模型 ¥2.57 175 次 规划器 ¥0.6668 96 次

eghrhegpe avatar Jun 20 '26 13:06 eghrhegpe