← Back to Plugins
Tools

Hermes Card

wzgrx By wzgrx 👁 40 views ▲ 0 votes

Universal Feishu card plugin for OpenClaw + Hermes

GitHub

Install

pip install 就绪

README

# OpenClaw-Hermes Card

> Unified Feishu/Lark card plugin for **OpenClaw** + **Hermes Agent**.

**完全自动化的飞书卡片系统:**
- 💬 **流式对话卡** — AI 回复实时更新,完成变绿 + 6行页脚
- 📊 **独立进度卡** — 长任务自动弹出 `██████ 75% ETA 2m`
- 🖥️ **系统监控面板** — GPU/CPU/RAM占用、Token统计、费用

## 一句话

```bash
bash install.sh    # 一键部署:OpenClaw + Hermes 全自动
```

## 快速开始

```bash
# 1. 克隆
git clone https://github.com/wzgrx/openclaw-hermes-card.git
cd openclaw-hermes-card

# 2. 一键部署(自动检测环境、安装补丁、配置、重启)
bash install.sh

# 3. 在飞书 @机器人 发消息测试
# 4. 跑长任务自动弹出进度卡片
```

## 架构

```
openclaw-hermes-card/
├── core/                          ← 平台无关核心 (Python)
│   ├── card_builder.py            ← 4种卡片构建(进度/完成/错误/列表)
│   ├── feishu_client.py           ← Feishu API 客户端(Token/IM/CardKit)
│   └── server.py                  ← HTTP API 服务 :18901
│       ├── POST /api/progress     ← 进度推送 → 独立卡片
│       ├── POST /api/card/event   ← Hermes 网关事件 → 对话卡片
│       ├── POST /api/card         ← 任意卡片发送
│       ├── GET  /api/tasks        ← 任务列表
│       └── GET  /health           ← 健康检查
│
├── hermes/                        ← Hermes Agent 适配
│   └── gateway_hook.py            ← 网关 Hook(替换旧的 streaming card)
│
├── openclaw/                      ← OpenClaw 适配
│   ├── lark-plugin-patches/       ← builder.js/monitor.js 等 13 个补丁
│   ├── progress/                  ← TaskManager v2 + 独立卡片构建
│   └── deploy.sh                  ← 部署脚本
│
├── scripts/                       ← 辅助工具
│   ├── auto_progress.py           ← 自动检测 wget/make/git 进度
│   └── send_progress.py           ← 手动推送进度
│
├── deploy/                        ← 部署配置
│   └── unified-card-server.service ← systemd 服务
│
├── install.sh                     ← 一键安装(推荐)
├── pyproject.toml                 ← pip install 就绪
└── README.md
```

## 卡片效果

| 场景 | 飞书看到 |
|------|---------|
| 🤖 对话回复 | 💬 蓝色 "思考中" → 完成后变绿 + 6行页脚 |
| 📥 下载模型 | 🟢 独立 `██████ 60% ETA 2m` → 完成变绿 ✅ |
| 🔧 编译项目 | 🟢 独立 `████░░ 40%` → 失败变红 ❌ + 错误详情 |
| 📋 多任务 | `/tasks` 汇总所有后台任务进度 |
| 📄 对话页脚 | `🪙 Token` `💸 费用` `📑 上下文` `💰 模型` |

## 手动启动

```bash
# 统一卡片服务(独立进度卡片 + API)
systemctl --user start openclaw-hermes-card

# 查看日志
journalctl --user -u openclaw-hermes-card -f

# 测试 API
curl -X POST http://localhost:18901/api/progress \
  -H "Content-Type: application/json" \
  -d '{"taskId":"my_task","name":"下载模型","progress":45,"status":"running","chatId":"oc_xxxxx"}'

curl http://localhost:18901/health
```

## 技术栈

| 组件 | 技术 |
|------|------|
| 核心服务 | Python 3.11+ / aiohttp / httpx |
| OpenClaw 侧 | Node.js / @larksuite/openclaw-lark |
| Hermes 侧 | Python gateway hook |
| 卡片 API | Feishu IM API (POST/PATCH) + CardKit |
| 部署 | systemd user service |
| 监控 | auto_progress.py 自动检测 |

## License

MIT
tools

Comments

Sign in to leave a comment

Loading comments...