2026-07-09 17:32:44 +08:00
|
|
|
# OpenClaw Agent Sessions Viewer
|
|
|
|
|
|
|
|
|
|
智能体会话历史查看器 - 一个用于展示 OpenClaw 智能体历史会话信息的网页工具。
|
|
|
|
|
|
|
|
|
|
## 功能
|
|
|
|
|
|
|
|
|
|
- 📋 **智能体列表** - 显示所有智能体及其会话数量
|
|
|
|
|
- 💬 **会话列表** - 查看每个智能体的会话,包含渠道、状态、模型等信息
|
|
|
|
|
- 📝 **消息详情** - 浏览会话中的完整消息历史
|
|
|
|
|
- 🔍 **完整内容查看** - 对于长消息,可点击查看完整内容
|
|
|
|
|
|
|
|
|
|
## 技术栈
|
|
|
|
|
|
|
|
|
|
- **后端**: Node.js + Express
|
|
|
|
|
- **前端**: 纯 HTML/CSS/JavaScript(无框架)
|
|
|
|
|
- **数据源**: `/home/openclaw/.openclaw/agents/` 目录下的 JSONL 会话文件
|
|
|
|
|
|
|
|
|
|
## 部署
|
|
|
|
|
|
|
|
|
|
### 快速启动
|
|
|
|
|
|
|
|
|
|
```bash
|
|
|
|
|
cd /home/openclaw/.openclaw/workspace-hz4th_coder/works/agent-sessions-viewer
|
|
|
|
|
npm install
|
|
|
|
|
npm start
|
|
|
|
|
```
|
|
|
|
|
|
2026-07-09 17:39:28 +08:00
|
|
|
服务将在 **端口 16040** 启动。
|
2026-07-09 17:32:44 +08:00
|
|
|
|
2026-07-09 17:39:28 +08:00
|
|
|
访问地址: http://localhost:16040
|
2026-07-09 17:32:44 +08:00
|
|
|
|
|
|
|
|
### systemd 服务(持久运行)
|
|
|
|
|
|
|
|
|
|
```bash
|
|
|
|
|
sudo cp agent-sessions-viewer.service /etc/systemd/system/
|
|
|
|
|
sudo systemctl daemon-reload
|
|
|
|
|
sudo systemctl enable agent-sessions-viewer
|
|
|
|
|
sudo systemctl start agent-sessions-viewer
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
## API 接口
|
|
|
|
|
|
|
|
|
|
| 接口 | 描述 |
|
|
|
|
|
|------|------|
|
|
|
|
|
| `GET /api/agents` | 获取所有智能体列表 |
|
|
|
|
|
| `GET /api/agents/:name/sessions` | 获取指定智能体的会话列表 |
|
|
|
|
|
| `GET /api/agents/:name/sessions/:id/messages` | 获取指定会话的消息列表 |
|
|
|
|
|
| `GET /api/agents/:name/sessions/:id/messages/:msgId` | 获取单条消息的完整内容 |
|
|
|
|
|
|
|
|
|
|
## 界面预览
|
|
|
|
|
|
|
|
|
|

|
|
|
|
|
|
|
|
|
|
- 左栏:智能体列表(按最近活跃时间排序)
|
|
|
|
|
- 中栏:会话列表(显示渠道、模型、token统计)
|
|
|
|
|
- 右栏:消息详情(用户/助手消息区分显示)
|
|
|
|
|
|
|
|
|
|
## 作者
|
|
|
|
|
|
|
|
|
|
hz4th_coder - OpenClaw 黄庄4号程序员
|