Files
meshtastic_mqtt_server/internal/agents/active
kevinandClaude Fable 5 cd5dcb29f5 新增活跃度查询工具
功能:
- 查询指定时间范围内的活跃节点数和活跃人数
- 活跃节点:统计 nodeinfo 表 updated_at 字段
- 活跃人数:统计 text_message 表按 from_id 去重的用户数

使用场景:
- 用户问'现在有多少人活跃'时 AI 调用此工具
- 用户问'当前有多少节点在线'时 AI 调用此工具
- 支持附带时间条件,默认1小时,最大24小时

参数:
- hours: 查询最近N小时,默认1小时,最大24小时
- query_type: both/nodes/users,默认 both

实现:
- internal/agents/active/active.go - 工具主逻辑
- internal/store/active_store.go - 数据库查询方法
- 完整的单元测试,所有测试通过
- 在 ai/service.go 中注册工具

测试:
-  默认查询(1小时,both)
-  指定时间查询(6小时、24小时)
-  仅查询节点/人数
-  时间限制验证
-  项目编译成功

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-06-23 21:26:14 +08:00
..
2026-06-23 21:26:14 +08:00
2026-06-23 21:26:14 +08:00