forked from Zakaria/hermes-agent
Hermes-agent
This commit is contained in:
+135
@@ -0,0 +1,135 @@
|
||||
---
|
||||
title: "Blender Mcp — 通过 socket 连接 blender-mcp 插件,直接从 Hermes 控制 Blender"
|
||||
sidebar_label: "Blender Mcp"
|
||||
description: "通过 socket 连接 blender-mcp 插件,直接从 Hermes 控制 Blender"
|
||||
---
|
||||
|
||||
{/* This page is auto-generated from the skill's SKILL.md by website/scripts/generate-skill-docs.py. Edit the source SKILL.md, not this page. */}
|
||||
|
||||
# Blender Mcp
|
||||
|
||||
通过 socket 连接 blender-mcp 插件,直接从 Hermes 控制 Blender。可创建 3D 对象、材质、动画,并运行任意 Blender Python(bpy)代码。当用户需要在 Blender 中创建或修改任何内容时使用。
|
||||
|
||||
## Skill 元数据
|
||||
|
||||
| | |
|
||||
|---|---|
|
||||
| 来源 | 可选 — 通过 `hermes skills install official/creative/blender-mcp` 安装 |
|
||||
| 路径 | `optional-skills/creative/blender-mcp` |
|
||||
| 版本 | `1.0.0` |
|
||||
| 作者 | alireza78a |
|
||||
| 平台 | linux, macos, windows |
|
||||
|
||||
## 参考:完整 SKILL.md
|
||||
|
||||
:::info
|
||||
以下是 Hermes 在触发此 skill 时加载的完整 skill 定义。这是 agent 在 skill 激活时所看到的指令内容。
|
||||
:::
|
||||
|
||||
# Blender MCP
|
||||
|
||||
通过 TCP 端口 9876 上的 socket,从 Hermes 控制正在运行的 Blender 实例。
|
||||
|
||||
## 设置(一次性)
|
||||
|
||||
### 1. 安装 Blender 插件
|
||||
|
||||
curl -sL https://raw.githubusercontent.com/ahujasid/blender-mcp/main/addon.py -o ~/Desktop/blender_mcp_addon.py
|
||||
|
||||
在 Blender 中:
|
||||
Edit > Preferences > Add-ons > Install > 选择 blender_mcp_addon.py
|
||||
启用 "Interface: Blender MCP"
|
||||
|
||||
### 2. 在 Blender 中启动 socket 服务器
|
||||
|
||||
在 Blender 视口中按 N 键打开侧边栏。
|
||||
找到 "BlenderMCP" 标签页,点击 "Start Server"。
|
||||
|
||||
### 3. 验证连接
|
||||
|
||||
nc -z -w2 localhost 9876 && echo "OPEN" || echo "CLOSED"
|
||||
|
||||
## 协议
|
||||
|
||||
通过 TCP 传输纯 UTF-8 JSON — 无长度前缀。
|
||||
|
||||
发送: {"type": "<command>", "params": {<kwargs>}}
|
||||
接收: {"status": "success", "result": <value>}
|
||||
{"status": "error", "message": "<reason>"}
|
||||
|
||||
## 可用命令
|
||||
|
||||
| type | params | 说明 |
|
||||
|-------------------------|-------------------|---------------------------------|
|
||||
| execute_code | code (str) | 运行任意 bpy Python 代码 |
|
||||
| get_scene_info | (无) | 列出场景中的所有对象 |
|
||||
| get_object_info | object_name (str) | 获取特定对象的详细信息 |
|
||||
| get_viewport_screenshot | (无) | 截取当前视口截图 |
|
||||
|
||||
## Python 辅助函数
|
||||
|
||||
在 execute_code 工具调用中使用:
|
||||
|
||||
import socket, json
|
||||
|
||||
def blender_exec(code: str, host="localhost", port=9876, timeout=15):
|
||||
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
||||
s.connect((host, port))
|
||||
s.settimeout(timeout)
|
||||
payload = json.dumps({"type": "execute_code", "params": {"code": code}})
|
||||
s.sendall(payload.encode("utf-8"))
|
||||
buf = b""
|
||||
while True:
|
||||
try:
|
||||
chunk = s.recv(4096)
|
||||
if not chunk:
|
||||
break
|
||||
buf += chunk
|
||||
try:
|
||||
json.loads(buf.decode("utf-8"))
|
||||
break
|
||||
except json.JSONDecodeError:
|
||||
continue
|
||||
except socket.timeout:
|
||||
break
|
||||
s.close()
|
||||
return json.loads(buf.decode("utf-8"))
|
||||
|
||||
## 常用 bpy 模式
|
||||
|
||||
### 清空场景
|
||||
bpy.ops.object.select_all(action='SELECT')
|
||||
bpy.ops.object.delete()
|
||||
|
||||
### 添加网格对象
|
||||
bpy.ops.mesh.primitive_uv_sphere_add(radius=1, location=(0, 0, 0))
|
||||
bpy.ops.mesh.primitive_cube_add(size=2, location=(3, 0, 0))
|
||||
bpy.ops.mesh.primitive_cylinder_add(radius=0.5, depth=2, location=(-3, 0, 0))
|
||||
|
||||
### 创建并指定材质
|
||||
mat = bpy.data.materials.new(name="MyMat")
|
||||
mat.use_nodes = True
|
||||
bsdf = mat.node_tree.nodes.get("Principled BSDF")
|
||||
bsdf.inputs["Base Color"].default_value = (R, G, B, 1.0)
|
||||
bsdf.inputs["Roughness"].default_value = 0.3
|
||||
bsdf.inputs["Metallic"].default_value = 0.0
|
||||
obj.data.materials.append(mat)
|
||||
|
||||
### 关键帧动画
|
||||
obj.location = (0, 0, 0)
|
||||
obj.keyframe_insert(data_path="location", frame=1)
|
||||
obj.location = (0, 0, 3)
|
||||
obj.keyframe_insert(data_path="location", frame=60)
|
||||
|
||||
### 渲染到文件
|
||||
bpy.context.scene.render.filepath = "/tmp/render.png"
|
||||
bpy.context.scene.render.engine = 'CYCLES'
|
||||
bpy.ops.render.render(write_still=True)
|
||||
|
||||
## 注意事项
|
||||
|
||||
- 运行前必须检查 socket 是否已开放(nc -z localhost 9876)
|
||||
- 每次会话都需要在 Blender 内部启动插件服务器(N 面板 > BlenderMCP > Connect)
|
||||
- 将复杂场景拆分为多个较小的 execute_code 调用,以避免超时
|
||||
- 渲染输出路径必须为绝对路径(/tmp/...),不能使用相对路径
|
||||
- `shade_smooth()` 要求对象已被选中且处于对象模式
|
||||
+379
@@ -0,0 +1,379 @@
|
||||
---
|
||||
title: "概念图"
|
||||
sidebar_label: "概念图"
|
||||
description: "以统一的教育视觉语言生成扁平、简约、支持明暗模式的 SVG 图表,输出为独立 HTML 文件,包含 9 种语义色阶、句首大写排版及自动暗色模式。..."
|
||||
---
|
||||
|
||||
{/* This page is auto-generated from the skill's SKILL.md by website/scripts/generate-skill-docs.py. Edit the source SKILL.md, not this page. */}
|
||||
|
||||
# 概念图
|
||||
|
||||
以统一的教育视觉语言生成扁平、简约、支持明暗模式的 SVG 图表,输出为独立 HTML 文件,包含 9 种语义色阶、句首大写排版及自动暗色模式。最适合教育类和非软件类视觉内容——物理装置、化学机制、数学曲线、实物(飞机、涡轮机、智能手机、机械表)、解剖图、平面图、截面图、叙事流程(X 的生命周期、Y 的过程)、中心辐射型系统集成(智慧城市、IoT)以及爆炸分层视图。若已有更专业的 skill 适用于该主题(专用软件/云架构、手绘草图、动画说明等),优先使用那些 skill——否则本 skill 也可作为通用 SVG 图表的备选方案,具备简洁的教育风格外观。内置 15 个示例图表。
|
||||
|
||||
## Skill 元数据
|
||||
|
||||
| | |
|
||||
|---|---|
|
||||
| 来源 | 可选 — 通过 `hermes skills install official/creative/concept-diagrams` 安装 |
|
||||
| 路径 | `optional-skills/creative/concept-diagrams` |
|
||||
| 版本 | `0.1.0` |
|
||||
| 作者 | v1k22(原始 PR),移植至 hermes-agent |
|
||||
| 许可证 | MIT |
|
||||
| 平台 | linux, macos, windows |
|
||||
| 标签 | `diagrams`, `svg`, `visualization`, `education`, `physics`, `chemistry`, `engineering` |
|
||||
| 相关 skills | [`architecture-diagram`](/user-guide/skills/bundled/creative/creative-architecture-diagram), [`excalidraw`](/user-guide/skills/bundled/creative/creative-excalidraw), `generative-widgets` |
|
||||
|
||||
## 参考:完整 SKILL.md
|
||||
|
||||
:::info
|
||||
以下是 Hermes 在触发本 skill 时加载的完整 skill 定义。这是 agent 在 skill 激活时所看到的指令内容。
|
||||
:::
|
||||
|
||||
# 概念图
|
||||
|
||||
使用统一的扁平、简约设计系统生成生产级 SVG 图表。输出为单个自包含 HTML 文件,可在任何现代浏览器中一致渲染,并自动支持明暗模式。
|
||||
|
||||
## 适用范围
|
||||
|
||||
**最适合:**
|
||||
- 物理装置、化学机制、数学曲线、生物学
|
||||
- 实物(飞机、涡轮机、智能手机、机械表、细胞)
|
||||
- 解剖图、截面图、爆炸分层视图
|
||||
- 平面图、建筑改造图
|
||||
- 叙事流程(X 的生命周期、Y 的过程)
|
||||
- 中心辐射型系统集成(智慧城市、IoT 网络、电网)
|
||||
- 任何领域的教育/教科书风格视觉内容
|
||||
- 定量图表(分组柱状图、能量曲线)
|
||||
|
||||
**优先考虑其他方案:**
|
||||
- 具有深色科技风格的专用软件/云基础设施架构(如有 `architecture-diagram` 可用,优先使用)
|
||||
- 手绘白板草图(如有 `excalidraw` 可用,优先使用)
|
||||
- 动画说明或视频输出(考虑动画 skill)
|
||||
|
||||
若已有更专业的 skill 适用于该主题,优先使用。若无合适选项,本 skill 可作为通用 SVG 图表备选方案——输出将呈现下文描述的简洁教育风格,适用于几乎任何主题。
|
||||
|
||||
## 工作流程
|
||||
|
||||
1. 确定图表类型(见下方"图表类型")。
|
||||
2. 使用设计系统规则布局组件。
|
||||
3. 使用 `templates/template.html` 作为包装器编写完整 HTML 页面——将 SVG 粘贴到模板中 `<!-- PASTE SVG HERE -->` 的位置。
|
||||
4. 保存为独立 `.html` 文件(例如 `~/my-diagram.html` 或 `./my-diagram.html`)。
|
||||
5. 用户直接在浏览器中打开——无需服务器,无需依赖。
|
||||
|
||||
可选:若用户需要可浏览的多图表画廊,参见底部"本地预览服务器"。
|
||||
|
||||
加载 HTML 模板:
|
||||
```
|
||||
skill_view(name="concept-diagrams", file_path="templates/template.html")
|
||||
```
|
||||
|
||||
模板内嵌完整 CSS 设计系统(`c-*` 颜色类、文本类、明暗变量、箭头标记样式)。你生成的 SVG 依赖这些类存在于宿主页面中。
|
||||
|
||||
---
|
||||
|
||||
## 设计系统
|
||||
|
||||
### 设计理念
|
||||
|
||||
- **扁平**:无渐变、无投影、无模糊、无发光、无霓虹效果。
|
||||
- **简约**:只展示核心内容,框内无装饰性图标。
|
||||
- **一致**:每张图表使用相同的颜色、间距、排版和描边宽度。
|
||||
- **暗色模式就绪**:所有颜色通过 CSS 类自动适配——无需为每种模式单独编写 SVG。
|
||||
|
||||
### 调色板
|
||||
|
||||
9 种色阶,每种 7 个色阶值。将类名放在 `<g>` 或形状元素上;模板 CSS 自动处理明暗两种模式。
|
||||
|
||||
| 类名 | 50(最浅) | 100 | 200 | 400 | 600 | 800 | 900(最深) |
|
||||
|------------|---------------|---------|---------|---------|---------|---------|---------------|
|
||||
| `c-purple` | #EEEDFE | #CECBF6 | #AFA9EC | #7F77DD | #534AB7 | #3C3489 | #26215C |
|
||||
| `c-teal` | #E1F5EE | #9FE1CB | #5DCAA5 | #1D9E75 | #0F6E56 | #085041 | #04342C |
|
||||
| `c-coral` | #FAECE7 | #F5C4B3 | #F0997B | #D85A30 | #993C1D | #712B13 | #4A1B0C |
|
||||
| `c-pink` | #FBEAF0 | #F4C0D1 | #ED93B1 | #D4537E | #993556 | #72243E | #4B1528 |
|
||||
| `c-gray` | #F1EFE8 | #D3D1C7 | #B4B2A9 | #888780 | #5F5E5A | #444441 | #2C2C2A |
|
||||
| `c-blue` | #E6F1FB | #B5D4F4 | #85B7EB | #378ADD | #185FA5 | #0C447C | #042C53 |
|
||||
| `c-green` | #EAF3DE | #C0DD97 | #97C459 | #639922 | #3B6D11 | #27500A | #173404 |
|
||||
| `c-amber` | #FAEEDA | #FAC775 | #EF9F27 | #BA7517 | #854F0B | #633806 | #412402 |
|
||||
| `c-red` | #FCEBEB | #F7C1C1 | #F09595 | #E24B4A | #A32D2D | #791F1F | #501313 |
|
||||
|
||||
#### 颜色分配规则
|
||||
|
||||
颜色编码**语义**,而非顺序。切勿像彩虹一样循环使用颜色。
|
||||
|
||||
- 按**类别**对节点分组——同类型的所有节点共用一种颜色。
|
||||
- 对中性/结构性节点(起点、终点、通用步骤、用户)使用 `c-gray`。
|
||||
- 每张图表使用 **2-3 种颜色**,而非 6 种以上。
|
||||
- 通用类别优先使用 `c-purple`、`c-teal`、`c-coral`、`c-pink`。
|
||||
- 将 `c-blue`、`c-green`、`c-amber`、`c-red` 保留用于语义含义(信息、成功、警告、错误)。
|
||||
|
||||
明暗色阶映射(由模板 CSS 处理——直接使用类名即可):
|
||||
- 亮色模式:50 填充 + 600 描边 + 800 标题 / 600 副标题
|
||||
- 暗色模式:800 填充 + 200 描边 + 100 标题 / 200 副标题
|
||||
|
||||
### 排版
|
||||
|
||||
只有两种字体大小,不得例外。
|
||||
|
||||
| 类名 | 大小 | 字重 | 用途 |
|
||||
|-------|------|--------|-----|
|
||||
| `th` | 14px | 500 | 节点标题、区域标签 |
|
||||
| `ts` | 12px | 400 | 副标题、描述、箭头标签 |
|
||||
| `t` | 14px | 400 | 通用文本 |
|
||||
|
||||
- **始终使用句首大写。** 禁止首字母大写(Title Case),禁止全大写(ALL CAPS)。
|
||||
- 每个 `<text>` 必须带有类名(`t`、`ts` 或 `th`),不得有无类名的文本。
|
||||
- 框内所有文本使用 `dominant-baseline="central"`。
|
||||
- 框内居中文本使用 `text-anchor="middle"`。
|
||||
|
||||
**宽度估算(近似值):**
|
||||
- 14px 字重 500:每字符约 8px
|
||||
- 12px 字重 400:每字符约 6.5px
|
||||
- 始终验证:`box_width >= (字符数 × px/字符) + 48`(每侧 24px 内边距)
|
||||
|
||||
### 间距与布局
|
||||
|
||||
- **ViewBox**:`viewBox="0 0 680 H"`,其中 H = 内容高度 + 40px 缓冲。
|
||||
- **安全区域**:x=40 至 x=640,y=40 至 y=(H-40)。
|
||||
- **框间距**:最小 60px。
|
||||
- **框内边距**:水平 24px,垂直 12px。
|
||||
- **箭头间隙**:箭头与框边缘之间 10px。
|
||||
- **单行框**:高度 44px。
|
||||
- **双行框**:高度 56px,标题与副标题基线间距 18px。
|
||||
- **容器内边距**:每个容器内部最小 20px。
|
||||
- **最大嵌套层级**:2-3 层。在 680px 宽度下更深的嵌套会难以阅读。
|
||||
|
||||
### 描边与形状
|
||||
|
||||
- **描边宽度**:所有节点边框 0.5px,不得使用 1px 或 2px。
|
||||
- **矩形圆角**:节点使用 `rx="8"`,内层容器使用 `rx="12"`,外层容器使用 `rx="16"` 至 `rx="20"`。
|
||||
- **连接路径**:必须设置 `fill="none"`,否则 SVG 默认填充为黑色。
|
||||
|
||||
### 箭头标记
|
||||
|
||||
在**每个** SVG 开头包含以下 `<defs>` 块:
|
||||
|
||||
```xml
|
||||
<defs>
|
||||
<marker id="arrow" viewBox="0 0 10 10" refX="8" refY="5"
|
||||
markerWidth="6" markerHeight="6" orient="auto-start-reverse">
|
||||
<path d="M2 1L8 5L2 9" fill="none" stroke="context-stroke"
|
||||
stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
|
||||
</marker>
|
||||
</defs>
|
||||
```
|
||||
|
||||
在线条上使用 `marker-end="url(#arrow)"`。箭头通过 `context-stroke` 继承线条颜色。
|
||||
|
||||
### CSS 类(由模板提供)
|
||||
|
||||
模板页面提供:
|
||||
|
||||
- 文本:`.t`、`.ts`、`.th`
|
||||
- 中性:`.box`、`.arr`、`.leader`、`.node`
|
||||
- 色阶:`.c-purple`、`.c-teal`、`.c-coral`、`.c-pink`、`.c-gray`、`.c-blue`、`.c-green`、`.c-amber`、`.c-red`(均自动支持明暗模式)
|
||||
|
||||
你**无需**重新定义这些类——直接在 SVG 中应用即可。模板文件包含完整的 CSS 定义。
|
||||
|
||||
---
|
||||
|
||||
## SVG 样板代码
|
||||
|
||||
模板页面中的每个 SVG 均以如下结构开头:
|
||||
|
||||
```xml
|
||||
<svg width="100%" viewBox="0 0 680 {HEIGHT}" xmlns="http://www.w3.org/2000/svg">
|
||||
<defs>
|
||||
<marker id="arrow" viewBox="0 0 10 10" refX="8" refY="5"
|
||||
markerWidth="6" markerHeight="6" orient="auto-start-reverse">
|
||||
<path d="M2 1L8 5L2 9" fill="none" stroke="context-stroke"
|
||||
stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
|
||||
</marker>
|
||||
</defs>
|
||||
|
||||
<!-- Diagram content here -->
|
||||
|
||||
</svg>
|
||||
```
|
||||
|
||||
将 `{HEIGHT}` 替换为实际计算高度(最后一个元素底部 + 40px)。
|
||||
|
||||
### 节点模式
|
||||
|
||||
**单行节点(44px):**
|
||||
```xml
|
||||
<g class="node c-blue">
|
||||
<rect x="100" y="20" width="180" height="44" rx="8" stroke-width="0.5"/>
|
||||
<text class="th" x="190" y="42" text-anchor="middle" dominant-baseline="central">Service name</text>
|
||||
</g>
|
||||
```
|
||||
|
||||
**双行节点(56px):**
|
||||
```xml
|
||||
<g class="node c-teal">
|
||||
<rect x="100" y="20" width="200" height="56" rx="8" stroke-width="0.5"/>
|
||||
<text class="th" x="200" y="38" text-anchor="middle" dominant-baseline="central">Service name</text>
|
||||
<text class="ts" x="200" y="56" text-anchor="middle" dominant-baseline="central">Short description</text>
|
||||
</g>
|
||||
```
|
||||
|
||||
**连接线(无标签):**
|
||||
```xml
|
||||
<line x1="200" y1="76" x2="200" y2="120" class="arr" marker-end="url(#arrow)"/>
|
||||
```
|
||||
|
||||
**容器(虚线或实线):**
|
||||
```xml
|
||||
<g class="c-purple">
|
||||
<rect x="40" y="92" width="600" height="300" rx="16" stroke-width="0.5"/>
|
||||
<text class="th" x="66" y="116">Container label</text>
|
||||
<text class="ts" x="66" y="134">Subtitle info</text>
|
||||
</g>
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 图表类型
|
||||
|
||||
根据主题选择合适的布局:
|
||||
|
||||
1. **流程图** — CI/CD 流水线、请求生命周期、审批工作流、数据处理。单向流(从上到下或从左到右),每行最多 4-5 个节点。
|
||||
2. **结构/包含图** — 云基础设施嵌套、分层系统架构。大型外层容器包含内层区域,虚线矩形表示逻辑分组。
|
||||
3. **API/端点映射** — REST 路由、GraphQL schema。从根节点树状展开,分支到资源组,每组包含端点节点。
|
||||
4. **微服务拓扑** — 服务网格、事件驱动系统。服务作为节点,箭头表示通信模式,消息队列位于服务之间。
|
||||
5. **数据流图** — ETL 流水线、流式架构。从数据源经处理流向数据汇,方向从左到右。
|
||||
6. **实物/结构图** — 交通工具、建筑、硬件、解剖图。使用与实物形态匹配的形状——弯曲体用 `<path>`,锥形用 `<polygon>`,圆柱部件用 `<ellipse>`/`<circle>`,隔间用嵌套 `<rect>`。参见 `references/physical-shape-cookbook.md`。
|
||||
7. **基础设施/系统集成图** — 智慧城市、IoT 网络、多域系统。中心辐射布局,中央平台连接各子系统。按系统使用语义线型(`.data-line`、`.power-line`、`.water-pipe`、`.road`)。参见 `references/infrastructure-patterns.md`。
|
||||
8. **UI/仪表盘原型** — 管理面板、监控仪表盘。屏幕框架内嵌套图表/仪表/指示器元素。参见 `references/dashboard-patterns.md`。
|
||||
|
||||
对于实物图、基础设施图和仪表盘图,生成前请先加载对应的参考文件——每个文件提供现成的 CSS 类和形状原语。
|
||||
|
||||
---
|
||||
|
||||
## 验证清单
|
||||
|
||||
在最终确定任何 SVG 之前,验证以下**所有**项目:
|
||||
|
||||
1. 每个 `<text>` 都有类名 `t`、`ts` 或 `th`。
|
||||
2. 框内每个 `<text>` 都有 `dominant-baseline="central"`。
|
||||
3. 用作箭头的每个连接 `<path>` 或 `<line>` 都有 `fill="none"`。
|
||||
4. 没有箭头线穿过无关的框。
|
||||
5. 14px 文本:`box_width >= (最长标签字符数 × 8) + 48`。
|
||||
6. 12px 文本:`box_width >= (最长标签字符数 × 6.5) + 48`。
|
||||
7. ViewBox 高度 = 最底部元素 + 40px。
|
||||
8. 所有内容在 x=40 至 x=640 范围内。
|
||||
9. 颜色类(`c-*`)放在 `<g>` 或形状元素上,不得放在 `<path>` 连接线上。
|
||||
10. 箭头 `<defs>` 块存在。
|
||||
11. 无渐变、投影、模糊或发光效果。
|
||||
12. 所有节点边框描边宽度为 0.5px。
|
||||
|
||||
---
|
||||
|
||||
## 输出与预览
|
||||
|
||||
### 默认:独立 HTML 文件
|
||||
|
||||
写入单个 `.html` 文件,用户可直接打开。无需服务器,无需依赖,离线可用。模式:
|
||||
|
||||
```python
|
||||
# 1. Load the template
|
||||
template = skill_view("concept-diagrams", "templates/template.html")
|
||||
|
||||
# 2. Fill in title, subtitle, and paste your SVG
|
||||
html = template.replace(
|
||||
"<!-- DIAGRAM TITLE HERE -->", "SN2 reaction mechanism"
|
||||
).replace(
|
||||
"<!-- OPTIONAL SUBTITLE HERE -->", "Bimolecular nucleophilic substitution"
|
||||
).replace(
|
||||
"<!-- PASTE SVG HERE -->", svg_content
|
||||
)
|
||||
|
||||
# 3. Write to a user-chosen path (or ./ by default)
|
||||
write_file("./sn2-mechanism.html", html)
|
||||
```
|
||||
|
||||
告知用户如何打开:
|
||||
|
||||
```
|
||||
# macOS
|
||||
open ./sn2-mechanism.html
|
||||
# Linux
|
||||
xdg-open ./sn2-mechanism.html
|
||||
```
|
||||
|
||||
### 可选:本地预览服务器(多图表画廊)
|
||||
|
||||
仅在用户明确需要可浏览的多图表画廊时使用。
|
||||
|
||||
**规则:**
|
||||
- 仅绑定到 `127.0.0.1`,绝不使用 `0.0.0.0`。在共享网络上将图表暴露在所有网络接口上存在安全风险。
|
||||
- 选择空闲端口(不得硬编码),并告知用户所选 URL。
|
||||
- 服务器是可选的、需用户主动选择的——优先使用独立 HTML 文件。
|
||||
|
||||
推荐模式(让操作系统选择空闲的临时端口):
|
||||
|
||||
```bash
|
||||
# Put each diagram in its own folder under .diagrams/
|
||||
mkdir -p .diagrams/sn2-mechanism
|
||||
# ...write .diagrams/sn2-mechanism/index.html...
|
||||
|
||||
# Serve on loopback only, free port
|
||||
cd .diagrams && python3 -c "
|
||||
import http.server, socketserver
|
||||
with socketserver.TCPServer(('127.0.0.1', 0), http.server.SimpleHTTPRequestHandler) as s:
|
||||
print(f'Serving at http://127.0.0.1:{s.server_address[1]}/')
|
||||
s.serve_forever()
|
||||
" &
|
||||
```
|
||||
|
||||
若用户坚持使用固定端口,使用 `127.0.0.1:<port>`——仍然不得使用 `0.0.0.0`。说明如何停止服务器(`kill %1` 或 `pkill -f "http.server"`)。
|
||||
|
||||
---
|
||||
|
||||
## 示例参考
|
||||
|
||||
`examples/` 目录内置 15 个完整、经过测试的图表。在编写同类型新图表之前,先浏览这些示例以获取可用模式:
|
||||
|
||||
| 文件 | 类型 | 演示内容 |
|
||||
|------|------|--------------|
|
||||
| `hospital-emergency-department-flow.md` | 流程图 | 带语义颜色的优先级路由 |
|
||||
| `feature-film-production-pipeline.md` | 流程图 | 分阶段工作流、水平子流程 |
|
||||
| `automated-password-reset-flow.md` | 流程图 | 带错误分支的认证流程 |
|
||||
| `autonomous-llm-research-agent-flow.md` | 流程图 | 回环箭头、决策分支 |
|
||||
| `place-order-uml-sequence.md` | 时序图 | UML 时序图风格 |
|
||||
| `commercial-aircraft-structure.md` | 实物图 | 使用路径、多边形、椭圆绘制真实形状 |
|
||||
| `wind-turbine-structure.md` | 实物截面图 | 地下/地上分离、颜色编码 |
|
||||
| `smartphone-layer-anatomy.md` | 爆炸视图 | 左右交替标签、分层组件 |
|
||||
| `apartment-floor-plan-conversion.md` | 平面图 | 墙体、门、虚线红色标注改造方案 |
|
||||
| `banana-journey-tree-to-smoothie.md` | 叙事流程 | 蜿蜒路径、渐进状态变化 |
|
||||
| `cpu-ooo-microarchitecture.md` | 硬件流水线 | 扇出、内存层次侧边栏 |
|
||||
| `sn2-reaction-mechanism.md` | 化学图 | 分子、弯曲箭头、能量曲线 |
|
||||
| `smart-city-infrastructure.md` | 中心辐射图 | 每个系统使用语义线型 |
|
||||
| `electricity-grid-flow.md` | 多阶段流程图 | 电压层次、流向标记 |
|
||||
| `ml-benchmark-grouped-bar-chart.md` | 图表 | 分组柱状图、双轴 |
|
||||
|
||||
使用以下命令加载任意示例:
|
||||
```
|
||||
skill_view(name="concept-diagrams", file_path="examples/<filename>")
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 快速参考:何时使用何种图表
|
||||
|
||||
| 用户说 | 图表类型 | 建议颜色 |
|
||||
|-----------|--------------|------------------|
|
||||
| "展示流水线" | 流程图 | 灰色起止点,紫色步骤,红色错误,青色部署 |
|
||||
| "画数据流" | 数据流水线(从左到右) | 灰色数据源,紫色处理,青色数据汇 |
|
||||
| "可视化系统" | 结构图(包含关系) | 紫色容器,青色服务,珊瑚色数据 |
|
||||
| "映射端点" | API 树状图 | 紫色根节点,每个资源组一种色阶 |
|
||||
| "展示服务" | 微服务拓扑 | 灰色入口,青色服务,紫色总线,珊瑚色 worker |
|
||||
| "画飞机/交通工具" | 实物图 | 路径、多边形、椭圆绘制真实形状 |
|
||||
| "智慧城市/IoT" | 中心辐射集成图 | 每个子系统使用语义线型 |
|
||||
| "展示仪表盘" | UI 原型 | 深色屏幕,图表颜色:青色、紫色、珊瑚色告警 |
|
||||
| "电网/电力" | 多阶段流程图 | 电压层次(高/中/低压线宽) |
|
||||
| "风力涡轮机/涡轮机" | 实物截面图 | 基础 + 塔筒截面 + 机舱颜色编码 |
|
||||
| "X 的旅程/生命周期" | 叙事流程 | 蜿蜒路径,渐进状态变化 |
|
||||
| "X 的层次/爆炸图" | 爆炸分层视图 | 垂直堆叠,交替标签 |
|
||||
| "CPU/流水线" | 硬件流水线 | 垂直阶段,扇出到执行端口 |
|
||||
| "平面图/公寓" | 平面图 | 墙体、门,虚线红色标注改造方案 |
|
||||
| "反应机制" | 化学图 | 原子、化学键、弯曲箭头、过渡态、能量曲线 |
|
||||
+205
@@ -0,0 +1,205 @@
|
||||
---
|
||||
title: "Hyperframes"
|
||||
sidebar_label: "Hyperframes"
|
||||
description: "使用 HyperFrames 创建基于 HTML 的视频合成、动画标题卡、社交叠加层、带字幕的对话视频、音频响应视觉效果和着色器转场..."
|
||||
---
|
||||
|
||||
{/* This page is auto-generated from the skill's SKILL.md by website/scripts/generate-skill-docs.py. Edit the source SKILL.md, not this page. */}
|
||||
|
||||
# Hyperframes
|
||||
|
||||
使用 HyperFrames 创建基于 HTML 的视频合成、动画标题卡、社交叠加层、带字幕的对话视频、音频响应视觉效果和着色器转场。HTML 是视频的唯一真实来源。当用户需要从 HTML 合成渲染 MP4/WebM、在媒体上添加文字/Logo/图表动画、将字幕与音频同步、需要 TTS 旁白,或将网站转换为视频时使用本技能。
|
||||
|
||||
## 技能元数据
|
||||
|
||||
| | |
|
||||
|---|---|
|
||||
| 来源 | 可选 — 通过 `hermes skills install official/creative/hyperframes` 安装 |
|
||||
| 路径 | `optional-skills/creative/hyperframes` |
|
||||
| 版本 | `1.0.0` |
|
||||
| 作者 | heygen-com |
|
||||
| 许可证 | Apache-2.0 |
|
||||
| 平台 | linux, macos, windows |
|
||||
| 标签 | `creative`, `video`, `animation`, `html`, `gsap`, `motion-graphics` |
|
||||
| 相关技能 | [`manim-video`](/user-guide/skills/bundled/creative/creative-manim-video), [`meme-generation`](/user-guide/skills/optional/creative/creative-meme-generation) |
|
||||
|
||||
## 参考:完整 SKILL.md
|
||||
|
||||
:::info
|
||||
以下是 Hermes 在触发本技能时加载的完整技能定义。这是 agent 在技能激活时所看到的指令内容。
|
||||
:::
|
||||
|
||||
# HyperFrames
|
||||
|
||||
HTML 是视频的唯一真实来源。合成(composition)是一个带有 `data-*` 属性用于计时、GSAP 时间轴用于动画、CSS 用于外观的 HTML 文件。HyperFrames 引擎逐帧捕获页面,并通过 FFmpeg 编码为 MP4/WebM。
|
||||
|
||||
**与 `manim-video` 的互补关系:** 数学/几何讲解(方程式、3B1B 风格)使用 `manim-video`。动态图形、带字幕的对话视频、产品演示、社交叠加层、着色器转场,以及任何由真实视频/音频媒体驱动的内容使用 `hyperframes`。
|
||||
|
||||
## 使用场景
|
||||
|
||||
- 用户要求从文本、脚本或网站渲染视频
|
||||
- 动画标题卡、下三分之一字幕条或排版片头
|
||||
- 带字幕的旁白视频(TTS + 字幕与波形同步)
|
||||
- 音频响应视觉效果(节拍同步、频谱条、脉冲发光)
|
||||
- 场景间转场(交叉淡入淡出、划像、着色器扭曲、闪白)
|
||||
- 社交叠加层(Instagram/TikTok/YouTube 风格)
|
||||
- 网站转视频流程(捕获 URL,生成宣传片)
|
||||
- 任何需要确定性渲染为视频文件的 HTML/CSS/JS 动画
|
||||
|
||||
**不适用**本技能的场景:
|
||||
- 纯数学/方程式动画(→ `manim-video`)
|
||||
- 图像生成或表情包(→ `meme-generation`,图像模型)
|
||||
- 实时视频会议或直播
|
||||
|
||||
## 快速参考
|
||||
|
||||
```bash
|
||||
npx hyperframes init my-video # 初始化项目脚手架
|
||||
cd my-video
|
||||
npx hyperframes lint # 预览/渲染前验证
|
||||
npx hyperframes preview # 实时热重载浏览器预览(端口 3002)
|
||||
npx hyperframes render --output final.mp4 # 渲染为 MP4
|
||||
npx hyperframes doctor # 诊断环境问题
|
||||
```
|
||||
|
||||
渲染参数:`--quality draft|standard|high` · `--fps 24|30|60` · `--format mp4|webm` · `--docker`(可复现)· `--strict`。
|
||||
|
||||
完整 CLI 参考:[references/cli.md](https://github.com/NousResearch/hermes-agent/blob/main/optional-skills/creative/hyperframes/references/cli.md)。
|
||||
|
||||
## 初始设置(一次性)
|
||||
|
||||
```bash
|
||||
bash "$(dirname "$(find ~/.hermes/skills -path '*/hyperframes/SKILL.md' 2>/dev/null | head -1)")/scripts/setup.sh"
|
||||
```
|
||||
|
||||
该脚本执行以下操作:
|
||||
1. 验证 Node.js >= 22 和 FFmpeg 已安装(若未安装则打印修复说明)。
|
||||
2. 全局安装 `hyperframes` CLI(`npm install -g hyperframes@>=0.4.2`)。
|
||||
3. 通过 Puppeteer 预缓存 `chrome-headless-shell` — **必需**,用于通过 Chrome 的 `HeadlessExperimental.beginFrame` 捕获路径实现最高质量渲染。
|
||||
4. 运行 `npx hyperframes doctor` 并报告结果。
|
||||
|
||||
若设置失败,请参阅 [references/troubleshooting.md](https://github.com/NousResearch/hermes-agent/blob/main/optional-skills/creative/hyperframes/references/troubleshooting.md)。
|
||||
|
||||
## 操作流程
|
||||
|
||||
### 1. 编写 HTML 前先规划
|
||||
|
||||
在接触代码之前,从高层次阐明:
|
||||
- **内容** — 叙事弧线、关键时刻、情感节拍
|
||||
- **结构** — 合成、轨道(视频/音频/叠加层)、时长
|
||||
- **视觉标识** — 颜色、字体、动态风格(爆炸感 / 电影感 / 流畅 / 技术感)
|
||||
- **主帧** — 每个场景中最多元素同时可见的时刻。这是你首先要构建的静态布局。
|
||||
|
||||
**视觉标识关卡(硬性关卡)。** 在编写任何合成 HTML 之前,必须先定义视觉标识。**不得**使用默认或通用颜色编写合成(`#333`、`#3b82f6`、`Roboto` 是跳过此步骤的明显标志)。按顺序检查:
|
||||
|
||||
1. **项目根目录有 `DESIGN.md`?** → 使用其中精确的颜色、字体、动态规则和"禁止事项"约束。
|
||||
2. **用户指定了风格**(如"Swiss Pulse"、"暗黑科技感"、"奢侈品牌")? → 生成一个包含 `## Style Prompt`、`## Colors`(3-5 个带角色的十六进制色值)、`## Typography`(1-2 个字体族)、`## What NOT to Do`(3-5 个反模式)的最小 `DESIGN.md`。
|
||||
3. **以上均无?** → 在编写任何 HTML 之前先提问 3 个问题:
|
||||
- 氛围?(爆炸感 / 电影感 / 流畅 / 技术感 / 混乱 / 温暖)
|
||||
- 浅色还是深色画布?
|
||||
- 是否有品牌颜色、字体或视觉参考?
|
||||
|
||||
然后根据答案生成 `DESIGN.md`。每个合成的调色板和排版都必须追溯到 `DESIGN.md` 或用户的明确指示。
|
||||
|
||||
### 2. 初始化脚手架
|
||||
|
||||
```bash
|
||||
npx hyperframes init my-video --non-interactive
|
||||
```
|
||||
|
||||
模板:`blank`、`warm-grain`、`play-mode`、`swiss-grid`、`vignelli`、`decision-tree`、`kinetic-type`、`product-promo`、`nyt-graph`。传入 `--example <name>` 选择模板,`--video clip.mp4` 或 `--audio track.mp3` 以媒体文件为起点。
|
||||
|
||||
### 3. 先布局,后动画
|
||||
|
||||
先为**主帧**编写静态 HTML+CSS — 暂不添加 GSAP。`.scene-content` 容器必须填满场景(`width:100%; height:100%; padding:Npx`),使用 `display:flex` + `gap`。用 padding 将内容向内推 — 永远不要在内容容器上使用 `position: absolute; top: Npx`(内容高于剩余空间时会溢出)。
|
||||
|
||||
只有在主帧看起来正确之后,才添加 `gsap.from()` 入场动画(**向** CSS 位置动画)和 `gsap.to()` 退场动画(**从** CSS 位置动画)。
|
||||
|
||||
完整的 data 属性 schema 和合成规则见 [references/composition.md](https://github.com/NousResearch/hermes-agent/blob/main/optional-skills/creative/hyperframes/references/composition.md)。
|
||||
|
||||
### 4. 使用 GSAP 制作动画
|
||||
|
||||
每个合成必须:
|
||||
- 注册其时间轴:`window.__timelines["<composition-id>"] = tl`
|
||||
- 初始暂停:`gsap.timeline({ paused: true })` — 播放器控制播放
|
||||
- 使用有限的 `repeat` 值(禁止 `repeat: -1` — 会破坏捕获引擎)。计算方式:`repeat: Math.ceil(duration / cycleDuration) - 1`。
|
||||
- 具有确定性 — 禁止 `Math.random()`、`Date.now()` 或挂钟逻辑。如需伪随机数,使用带种子的 PRNG。
|
||||
- 同步构建 — 时间轴构建过程中禁止 `async`/`await`、`setTimeout` 或 Promise。
|
||||
|
||||
核心 GSAP API(tween、ease、stagger、timeline)见 [references/gsap.md](https://github.com/NousResearch/hermes-agent/blob/main/optional-skills/creative/hyperframes/references/gsap.md)。
|
||||
|
||||
### 5. 场景间转场
|
||||
|
||||
多场景合成需要转场。规则:
|
||||
1. **场景间始终使用转场** — 禁止跳切。
|
||||
2. **每个场景元素始终使用入场动画**(`gsap.from(...)`)。
|
||||
3. **除最后一个场景外,禁止使用退场动画** — 转场本身就是退出。
|
||||
4. 最后一个场景可以淡出。
|
||||
|
||||
使用 `npx hyperframes add <transition-name>` 安装着色器转场(`flash-through-white`、`liquid-wipe` 等)。完整列表:`npx hyperframes add --list`。
|
||||
|
||||
### 6. 音频、字幕、TTS、音频响应、高亮
|
||||
|
||||
- **音频:** 始终使用独立的 `<audio>` 元素(视频使用 `muted playsinline`)。
|
||||
- **TTS:** `npx hyperframes tts "脚本文本" --voice af_nova --output narration.wav`。使用 `--list` 列出可用音色。音色 ID 首字母编码语言(`a`/`b`=英语,`e`=西班牙语,`f`=法语,`j`=日语,`z`=普通话等)— CLI 自动推断音素化(phonemizer)语言环境;仅在需要覆盖时传入 `--lang`。非英语音素化需要系统级安装 `espeak-ng`。
|
||||
- **字幕:** `npx hyperframes transcribe narration.wav` → 词级转录。根据转录内容的语气选择样式(hype / corporate / tutorial / storytelling / social — 见 `references/features.md` 中的表格)。**语言规则:** 除非确认音频为英语,否则永远不要使用 `.en` whisper 模型 — `.en` 会将非英语音频翻译而非转录。每个字幕组在其退出 tween 之后必须有一个硬性的 `tl.set(el, { opacity: 0, visibility: "hidden" }, group.end)` 清除 — 否则字幕组会泄漏到后续组中保持可见。
|
||||
- **音频响应视觉效果:** 预先提取音频频段(低频 / 中频 / 高频),并在时间轴内通过 `for` 循环的 `tl.call(draw, [], f / fps)` 逐帧采样 — 单个长 tween **不会**响应音频。将低频映射到 `scale`(脉冲),高频映射到 `textShadow`/`boxShadow`(发光),整体振幅映射到 `opacity`/`y`/`backgroundColor`。避免均衡器条形图的陈词滥调 — 让内容引导视觉,让音频驱动其行为。
|
||||
- **标记式高亮:** 文字强调的高亮、圆圈、爆炸、涂鸦、划除效果均为确定性 CSS+GSAP — 见 `references/features.md#marker-highlighting`。完全可寻址,无动画 SVG 滤镜。
|
||||
- **场景转场:** 每个多场景合成必须使用转场(禁止跳切)。从 CSS 原语(推入滑动、模糊交叉淡入淡出、缩放穿越、交错块)或着色器转场(`flash-through-white`、`liquid-wipe`、`cross-warp-morph`、`chromatic-split` 等,通过 `npx hyperframes add` 安装)中选择。氛围和能量对照表见 `references/features.md#transitions`。同一合成中不得混用 CSS 转场和着色器转场。
|
||||
|
||||
### 7. Lint、验证、检查、预览、渲染
|
||||
|
||||
```bash
|
||||
npx hyperframes lint # 捕获缺失的 data-composition-id、重叠轨道、未注册的时间轴
|
||||
npx hyperframes validate # 在 5 个时间戳进行 WCAG 对比度审计
|
||||
npx hyperframes inspect # 视觉布局审计 — 溢出、帧外元素、被遮挡的文字
|
||||
npx hyperframes preview # 实时浏览器预览
|
||||
npx hyperframes render --quality draft --output draft.mp4 # 快速迭代
|
||||
npx hyperframes render --quality high --output final.mp4 # 最终交付
|
||||
```
|
||||
|
||||
`hyperframes validate` 对每个文字元素后方的背景像素进行采样,并对对比度低于 4.5:1(大文字为 3:1)的情况发出警告。`hyperframes inspect` 是布局侧的配套工具 — 在多个时间戳运行页面,标记静态 lint 无法发现的问题(仅在 4.5s 时超出安全区域的字幕换行、标题为最长变体时溢出的卡片、被转场着色器遮挡的元素)。对于包含对话气泡、卡片、字幕或紧凑排版的合成,务必运行 `inspect`。
|
||||
|
||||
### 8. 网站转视频(若用户提供 URL)
|
||||
|
||||
使用 [references/website-to-video.md](https://github.com/NousResearch/hermes-agent/blob/main/optional-skills/creative/hyperframes/references/website-to-video.md) 中的 7 步捕获转视频工作流:捕获 → DESIGN.md → SCRIPT.md → 分镜 → 合成 → 渲染 → 交付。
|
||||
|
||||
## 常见陷阱
|
||||
|
||||
- **`HeadlessExperimental.beginFrame' wasn't found`** — Chromium 147+ 移除了此协议。确保使用 `hyperframes@>=0.4.2`(自动检测并回退到截图模式)。应急方案:`export PRODUCER_FORCE_SCREENSHOT=true`。参见 [hyperframes#294](https://github.com/heygen-com/hyperframes/issues/294) 和 [references/troubleshooting.md](https://github.com/NousResearch/hermes-agent/blob/main/optional-skills/creative/hyperframes/references/troubleshooting.md)。
|
||||
- **系统 Chrome(非 `chrome-headless-shell`)** — 渲染会挂起 120 秒后超时。运行 `npx puppeteer browsers install chrome-headless-shell`(setup.sh 已处理此步骤)。`hyperframes doctor` 会报告将使用哪个二进制文件。
|
||||
- **任何地方出现 `repeat: -1`** — 会破坏捕获引擎。始终计算有限的 repeat 次数。
|
||||
- **在稍后入场的 clip 元素上使用 `gsap.set()`** — 页面加载时该元素不存在。改为在时间轴内使用 `tl.set(selector, vars, timePosition)`,位置在该 clip 的 `data-start` 处或之后。
|
||||
- **内容文字中使用 `<br>`** — 强制换行不了解渲染字体宽度,导致自然换行 + `<br>` 双重换行。使用 `max-width` 让文字自然换行。例外:每个单词刻意独占一行的短展示标题。
|
||||
- **对 `visibility` 或 `display` 进行动画** — GSAP 无法对这些属性进行 tween。使用 `autoAlpha`(同时处理 visibility 和 opacity)。
|
||||
- **调用 `video.play()` 或 `audio.play()`** — 框架拥有播放控制权。永远不要自行调用这些方法。
|
||||
- **异步构建时间轴** — 捕获引擎在页面加载后同步读取 `window.__timelines`。永远不要将时间轴构建包裹在 `async`、`setTimeout` 或 Promise 中。
|
||||
- **独立 `index.html` 包裹在 `<template>` 中** — 会对浏览器隐藏所有内容。只有通过 `data-composition-src` 加载的**子合成**才使用 `<template>`。
|
||||
- **将视频用于音频** — 始终使用静音的 `<video>` + 独立的 `<audio>`。
|
||||
|
||||
## 验证
|
||||
|
||||
渲染前后均需执行:
|
||||
|
||||
1. **Lint + validate + inspect 通过:** `npx hyperframes lint --strict && npx hyperframes validate && npx hyperframes inspect`(lint 捕获结构问题,validate 捕获对比度问题,inspect 捕获视觉布局/溢出问题 — 若出现警告请参阅 troubleshooting.md)。
|
||||
2. **动画编排** — 对于新合成或重大动画变更,运行动画映射。`npx hyperframes init` 会将技能脚本复制到项目中,因此路径为项目本地路径:
|
||||
```bash
|
||||
node skills/hyperframes/scripts/animation-map.mjs <composition-dir> \
|
||||
--out <composition-dir>/.hyperframes/anim-map
|
||||
```
|
||||
输出单个 `animation-map.json`,包含每个 tween 的摘要、ASCII 甘特时间轴、stagger 检测、死区(超过 1 秒无动画)、元素生命周期和标记(`offscreen`、`collision`、`invisible`、`paced-fast` <0.2s、`paced-slow` >2s)。扫描摘要和标记 — 逐一修复或说明原因。小幅编辑可跳过。
|
||||
3. **文件存在且非零:** `ls -lh final.mp4`。
|
||||
4. **时长与 `data-duration` 匹配:** `ffprobe -v error -show_entries format=duration -of default=nw=1:nk=1 final.mp4`。
|
||||
5. **视觉检查:** 提取合成中间帧:`ffmpeg -i final.mp4 -ss 00:00:05 -vframes 1 preview.png`。
|
||||
6. **若预期有音频,确认音频存在:** `ffprobe -v error -show_streams -select_streams a -of default=nw=1:nk=1 final.mp4 | head -1`。
|
||||
|
||||
若 `hyperframes render` 失败,运行 `npx hyperframes doctor` 并在报告问题时附上其输出。
|
||||
|
||||
## 参考资料
|
||||
|
||||
- [composition.md](https://github.com/NousResearch/hermes-agent/blob/main/optional-skills/creative/hyperframes/references/composition.md) — data 属性、时间轴契约、不可违反的规则、排版/资源规则
|
||||
- [cli.md](https://github.com/NousResearch/hermes-agent/blob/main/optional-skills/creative/hyperframes/references/cli.md) — 所有 CLI 命令(init、capture、lint、validate、inspect、preview、render、transcribe、tts、doctor、browser、info、upgrade、benchmark)
|
||||
- [gsap.md](https://github.com/NousResearch/hermes-agent/blob/main/optional-skills/creative/hyperframes/references/gsap.md) — HyperFrames 的 GSAP 核心 API(tween、ease、stagger、timeline、matchMedia)
|
||||
- [features.md](https://github.com/NousResearch/hermes-agent/blob/main/optional-skills/creative/hyperframes/references/features.md) — 字幕、TTS、音频响应、标记高亮、转场(按需加载)
|
||||
- [website-to-video.md](https://github.com/NousResearch/hermes-agent/blob/main/optional-skills/creative/hyperframes/references/website-to-video.md) — 7 步捕获转视频工作流
|
||||
- [troubleshooting.md](https://github.com/NousResearch/hermes-agent/blob/main/optional-skills/creative/hyperframes/references/troubleshooting.md) — OpenClaw 修复、环境变量、常见渲染错误
|
||||
+173
@@ -0,0 +1,173 @@
|
||||
---
|
||||
title: "Kanban Video Orchestrator — 规划、搭建并监控由 Hermes Kanban 支撑的多智能体视频制作流水线"
|
||||
sidebar_label: "Kanban Video Orchestrator"
|
||||
description: "规划、搭建并监控由 Hermes Kanban 支撑的多智能体视频制作流水线"
|
||||
---
|
||||
|
||||
{/* This page is auto-generated from the skill's SKILL.md by website/scripts/generate-skill-docs.py. Edit the source SKILL.md, not this page. */}
|
||||
|
||||
# Kanban Video Orchestrator
|
||||
|
||||
规划、搭建并监控由 Hermes Kanban 支撑的多智能体视频制作流水线。当用户想要制作**任何**类型的视频时使用本技能——叙事短片、产品/营销视频、MV、解说视频、ASCII/终端艺术、抽象/生成循环、漫画、3D、实时/装置艺术——且工作需要分解为专业角色(编剧、设计师、动画师、渲染师、配音、剪辑等)并通过 kanban 看板协调。执行自适应探索以明确需求范围,为所请求的风格设计合适的团队,生成用于创建 Hermes profiles 和初始 kanban 任务的安装脚本,然后协助监控执行过程并在任务卡住或失败时介入。将场景路由到适合每个节拍的 Hermes 渲染/音频/设计技能(`ascii-video`、`manim-video`、`p5js`、`comfyui`、`touchdesigner-mcp`、`blender-mcp`、`pixel-art`、`baoyu-comic`、`claude-design`、`excalidraw`、`songsee`、`heartmula`……)以及用于 TTS、图像生成和图像转视频的外部 API。
|
||||
|
||||
## 技能元数据
|
||||
|
||||
| | |
|
||||
|---|---|
|
||||
| 来源 | 可选 — 通过 `hermes skills install official/creative/kanban-video-orchestrator` 安装 |
|
||||
| 路径 | `optional-skills/creative/kanban-video-orchestrator` |
|
||||
| 版本 | `1.0.0` |
|
||||
| 作者 | ['SHL0MS', 'alt-glitch'] |
|
||||
| 许可证 | MIT |
|
||||
| 平台 | linux, macos, windows |
|
||||
| 标签 | `video`, `kanban`, `multi-agent`, `orchestration`, `production-pipeline` |
|
||||
| 相关技能 | [`kanban-orchestrator`](/user-guide/skills/bundled/devops/devops-kanban-orchestrator)、[`kanban-worker`](/user-guide/skills/bundled/devops/devops-kanban-worker)、[`ascii-video`](/user-guide/skills/bundled/creative/creative-ascii-video)、[`manim-video`](/user-guide/skills/bundled/creative/creative-manim-video)、[`p5js`](/user-guide/skills/bundled/creative/creative-p5js)、[`comfyui`](/user-guide/skills/bundled/creative/creative-comfyui)、[`touchdesigner-mcp`](/user-guide/skills/bundled/creative/creative-touchdesigner-mcp)、[`blender-mcp`](/user-guide/skills/optional/creative/creative-blender-mcp)、[`pixel-art`](/user-guide/skills/bundled/creative/creative-pixel-art)、[`ascii-art`](/user-guide/skills/bundled/creative/creative-ascii-art)、[`songwriting-and-ai-music`](/user-guide/skills/bundled/creative/creative-songwriting-and-ai-music)、[`heartmula`](/user-guide/skills/bundled/media/media-heartmula)、[`songsee`](/user-guide/skills/bundled/media/media-songsee)、[`spotify`](/user-guide/skills/bundled/media/media-spotify)、[`youtube-content`](/user-guide/skills/bundled/media/media-youtube-content)、[`claude-design`](/user-guide/skills/bundled/creative/creative-claude-design)、[`excalidraw`](/user-guide/skills/bundled/creative/creative-excalidraw)、[`architecture-diagram`](/user-guide/skills/bundled/creative/creative-architecture-diagram)、[`concept-diagrams`](/user-guide/skills/optional/creative/creative-concept-diagrams)、[`baoyu-comic`](/user-guide/skills/bundled/creative/creative-baoyu-comic)、[`baoyu-infographic`](/user-guide/skills/bundled/creative/creative-baoyu-infographic)、[`humanizer`](/user-guide/skills/bundled/creative/creative-humanizer)、[`gif-search`](/user-guide/skills/bundled/media/media-gif-search)、[`meme-generation`](/user-guide/skills/optional/creative/creative-meme-generation) |
|
||||
|
||||
## 参考:完整 SKILL.md
|
||||
|
||||
:::info
|
||||
以下是 Hermes 在触发本技能时加载的完整技能定义。这是技能激活时智能体所看到的指令内容。
|
||||
:::
|
||||
|
||||
# Kanban Video Orchestrator
|
||||
|
||||
将任何视频请求——从 15 秒产品预告到 5 分钟叙事短片,再到 MV 或 ASCII 循环——封装进 Hermes Kanban 流水线,将工作分解给专业智能体 profiles。
|
||||
|
||||
本技能**不**自行渲染任何内容。它是一个元流水线,负责:
|
||||
|
||||
1. **探索**——通过有针对性的发现问题明确需求范围
|
||||
2. **设计**——根据风格设计合适的团队(哪些角色、每个角色使用哪些工具)
|
||||
3. **生成**——生成安装脚本,创建 Hermes profiles、项目工作区和初始 kanban 任务
|
||||
4. **交接**——移交给 director profile,由其通过 kanban 进行分解
|
||||
5. **监控**——跟踪执行过程,在任务卡住或失败时协助介入
|
||||
|
||||
实际渲染在 kanban 运行后在其内部完成,使用适合各场景的现有技能和工具——`ascii-video`、`manim-video`、`p5js`、`comfyui`、`touchdesigner-mcp`、`blender-mcp`、`songwriting-and-ai-music`、`heartmula`、外部 API,或使用 PIL + ffmpeg 的纯 Python。
|
||||
|
||||
## 不适用本技能的情况
|
||||
|
||||
- 视频是一个无需专业分工的连续程序化项目。直接编写代码即可。
|
||||
- 用户只需快速一次性转换(例如"把这个 mp4 转成 GIF")——直接使用 ffmpeg。
|
||||
- 输出是静态图片、GIF 或纯音频产物——使用对应的专项技能(`ascii-art`、`gifs`、`meme-generation`、`songwriting-and-ai-music`)。
|
||||
- 工作完全适合某个现有技能(例如纯 ASCII 视频——直接使用 `ascii-video`)。
|
||||
|
||||
## 工作流程
|
||||
|
||||
```
|
||||
DISCOVER → BRIEF → TEAM DESIGN → SETUP → EXECUTE → MONITOR
|
||||
```
|
||||
|
||||
### 第一步 — 探索(提出正确的问题)
|
||||
|
||||
探索过程是**自适应的**:只问真正需要的问题。始终从三个问题开始,以识别大致轮廓:
|
||||
|
||||
- **视频是什么?**(一句话简介)
|
||||
- **时长多少?**(5-30 秒预告 / 30-90 秒短片 / 90 秒-3 分钟解说 / 3-10 分钟影片 / 更长)
|
||||
- **宽高比和目标平台?**(1:1 / 9:16 / 16:9;X、IG、YouTube、内部使用等)
|
||||
|
||||
根据回答,对风格类别进行分类。风格决定后续需要提问的问题。**不要一次性问所有问题。** 每次问 2-4 个,倾听回答,然后继续。当用户的回答隐含某个答案时,做出合理假设。
|
||||
|
||||
完整的收集模式和各风格问题库,参见
|
||||
**[references/intake.md](https://github.com/NousResearch/hermes-agent/blob/main/optional-skills/creative/kanban-video-orchestrator/references/intake.md)**。
|
||||
|
||||
### 第二步 — 简报
|
||||
|
||||
掌握足够信息后,使用 `assets/brief.md.tmpl` 中的模板生成结构化的 `brief.md`。阶段如下:
|
||||
|
||||
1. **概念** — 一句话 pitch + 情感北极星
|
||||
2. **范围** — 时长、宽高比、平台、截止日期
|
||||
3. **风格** — 视觉参考、品牌约束、基调
|
||||
4. **场景** — 逐拍分解(时长、内容、目标工具)
|
||||
5. **音频** — 旁白 / 音乐 / 音效 / 静音(如需可按场景细分)
|
||||
6. **交付物** — 文件格式、分辨率、可选备选版本(竖版剪辑、GIF 等)
|
||||
|
||||
在设计团队之前,将简报展示给用户确认。**简报即合同**——所有下游任务均以其为参考。
|
||||
|
||||
### 第三步 — 团队设计
|
||||
|
||||
从角色库中挑选适合本视频的角色原型。**组合,而非复制。** 大多数视频需要 4-7 个 profiles。director 始终存在;其余角色根据简报的实际需求选取。
|
||||
|
||||
角色库和各风格团队组合,参见
|
||||
**[references/role-archetypes.md](https://github.com/NousResearch/hermes-agent/blob/main/optional-skills/creative/kanban-video-orchestrator/references/role-archetypes.md)**。
|
||||
|
||||
角色与 Hermes 技能及工具集的映射关系,参见
|
||||
**[references/tool-matrix.md](https://github.com/NousResearch/hermes-agent/blob/main/optional-skills/creative/kanban-video-orchestrator/references/tool-matrix.md)**。
|
||||
|
||||
### 第四步 — 安装
|
||||
|
||||
生成安装脚本(`setup.sh`)并运行。脚本将:
|
||||
|
||||
1. 创建项目工作区(`~/projects/video-pipeline/<slug>/`)
|
||||
2. 将提供的资产复制到 `taste/`、`audio/`、`assets/`
|
||||
3. 通过 `hermes profile create --clone` 创建每个 Hermes profile
|
||||
4. 编写各 profile 的 `SOUL.md`(个性 + 角色定义)
|
||||
5. 配置 profile YAML(工具集、always_load 技能、cwd)
|
||||
6. 编写 `brief.md`、`TEAM.md` 和 `taste/` 内容
|
||||
7. 触发分配给 director 的初始 `hermes kanban create` 任务
|
||||
|
||||
使用 `scripts/bootstrap_pipeline.py` 从简报 + 团队设计 JSON 生成 setup.sh。安装脚本结构、profile 配置模式和关键的"共享工作区"规则,参见 **[references/kanban-setup.md](https://github.com/NousResearch/hermes-agent/blob/main/optional-skills/creative/kanban-video-orchestrator/references/kanban-setup.md)**。
|
||||
|
||||
### 第五步 — 执行
|
||||
|
||||
运行 `setup.sh`。然后向用户提供监控命令:
|
||||
|
||||
```bash
|
||||
hermes kanban watch --tenant <project-tenant> # 实时事件
|
||||
hermes kanban list --tenant <project-tenant> # 看板快照
|
||||
hermes dashboard # 可视化看板 UI
|
||||
```
|
||||
|
||||
director profile 从此接管,通过 kanban 工具集将工作分解并路由给专业 profiles。
|
||||
|
||||
### 第六步 — 监控与介入
|
||||
|
||||
保持参与——kanban 自主运行,但卡住的任务或不良输出需要人工(或 AI)判断。
|
||||
|
||||
监控模式:定期轮询 `kanban list`,用 `kanban show <id>` 检查任何超出预期时长的 RUNNING 任务,并检查心跳。当某个 worker 的输出未通过审核时,标准介入方式为:
|
||||
|
||||
1. 在 worker 的任务上附上具体反馈评论(`kanban_comment`)
|
||||
2. 以原任务为父任务创建重新运行任务
|
||||
3. 调整简报范围,让 director 重新分解
|
||||
|
||||
诊断模式、介入方案和"任务卡住"处理手册,参见 **[references/monitoring.md](https://github.com/NousResearch/hermes-agent/blob/main/optional-skills/creative/kanban-video-orchestrator/references/monitoring.md)**。
|
||||
|
||||
## 参考:实际案例
|
||||
|
||||
六个涵盖截然不同视频风格的具体流水线——叙事短片、产品/营销视频、MV、数学/算法解说、ASCII 视频、实时装置——展示相同工作流程如何产生截然不同的团队和任务图。参见 **[references/examples.md](https://github.com/NousResearch/hermes-agent/blob/main/optional-skills/creative/kanban-video-orchestrator/references/examples.md)**。
|
||||
|
||||
## 关键规则
|
||||
|
||||
1. **行动前先探索。** 在至少提出三个基线问题之前,绝不开始生成简报或团队设计。糟糕的简报会在整个流水线中产生连锁反应。
|
||||
|
||||
2. **团队要匹配视频。** 不要对每个项目都复用同一套 4-profile 配置。没有节拍分析 profile 的 MV 会出错。没有编剧 profile 的叙事短片会产生不连贯的场景。参见 `references/role-archetypes.md`。
|
||||
|
||||
3. **每个项目一个工作区。** 同一视频的所有 profiles 共享同一个 `dir:` 工作区。任务通过共享文件系统和结构化交接传递产物。**每个** `kanban_create` 调用都传入 `workspace_kind="dir"` + `workspace_path="<绝对项目路径>"`。
|
||||
|
||||
4. **每个项目使用独立 tenant。** 使用项目专属 tenant(`--tenant <project-slug>`)。保持 dashboard 范围清晰,防止与其他正在进行的 kanban 交叉污染。
|
||||
|
||||
5. **尊重现有技能。** 当某个场景适合现有技能时,相关渲染器应通过任务上的 `--skill <name>` 或 profile 中的 `always_load` 加载该技能。不要重新推导技能已提供的内容。
|
||||
|
||||
6. **director 绝不执行。** 即使拥有完整的 `kanban + terminal + file` 工具集,director 的 `SOUL.md` 规则也禁止其自行执行工作。它只负责分解和路由——每个具体任务都变成对专业 profile 的 `hermes kanban create` 调用。`kanban-orchestrator` 技能对此有进一步说明。
|
||||
|
||||
7. **不要过度分解。** 一个 30 秒的产品视频**不需要** 20 个任务。目标是最小任务图,同时仍能良好并行化并暴露正确的人工审核节点。
|
||||
|
||||
8. **触发前验证 API 密钥。** 外部 API(TTS、图像生成、图像转视频)需要在 `~/.hermes/.env` 或用户密钥存储中配置密钥。遇到缺少密钥错误的 worker 会浪费一个任务槽。安装脚本的 `check_key` 辅助函数在缺少必要密钥时会干净地中止。
|
||||
|
||||
## 文件结构
|
||||
|
||||
```
|
||||
SKILL.md ← 本文件(工作流程 + 规则)
|
||||
references/
|
||||
intake.md ← 各风格的探索问题库
|
||||
role-archetypes.md ← 角色库(编剧、设计师、动画师……)
|
||||
tool-matrix.md ← 各角色的技能 + 工具集映射
|
||||
kanban-setup.md ← 安装脚本结构与 profile 配置
|
||||
monitoring.md ← 监控 + 介入模式
|
||||
examples.md ← 六个实际流水线案例
|
||||
assets/
|
||||
brief.md.tmpl ← 简报骨架
|
||||
setup.sh.tmpl ← 安装脚本骨架
|
||||
soul.md.tmpl ← profile 个性骨架
|
||||
scripts/
|
||||
bootstrap_pipeline.py ← 从简报 + 团队 JSON 生成 setup.sh
|
||||
monitor.py ← 轮询 + 介入辅助工具
|
||||
```
|
||||
+147
@@ -0,0 +1,147 @@
|
||||
---
|
||||
title: "Meme Generation — 使用 Pillow 选取模板并叠加文字,生成真实的表情包图片"
|
||||
sidebar_label: "Meme Generation"
|
||||
description: "使用 Pillow 选取模板并叠加文字,生成真实的表情包图片"
|
||||
---
|
||||
|
||||
{/* This page is auto-generated from the skill's SKILL.md by website/scripts/generate-skill-docs.py. Edit the source SKILL.md, not this page. */}
|
||||
|
||||
# Meme Generation
|
||||
|
||||
使用 Pillow 选取模板并叠加文字,生成真实的表情包图片。输出实际的 .png 表情包文件。
|
||||
|
||||
## Skill 元数据
|
||||
|
||||
| | |
|
||||
|---|---|
|
||||
| 来源 | 可选 — 通过 `hermes skills install official/creative/meme-generation` 安装 |
|
||||
| 路径 | `optional-skills/creative/meme-generation` |
|
||||
| 版本 | `2.0.0` |
|
||||
| 作者 | adanaleycio |
|
||||
| 许可证 | MIT |
|
||||
| 平台 | linux, macos, windows |
|
||||
| 标签 | `creative`, `memes`, `humor`, `images` |
|
||||
| 相关 skill | [`ascii-art`](/user-guide/skills/bundled/creative/creative-ascii-art), `generative-widgets` |
|
||||
|
||||
## 参考:完整 SKILL.md
|
||||
|
||||
:::info
|
||||
以下是 Hermes 在触发此 skill 时加载的完整 skill 定义。这是 agent 在 skill 激活时所看到的指令内容。
|
||||
:::
|
||||
|
||||
# Meme Generation
|
||||
|
||||
根据主题生成实际的表情包图片。选取模板、编写说明文字,并渲染带有文字叠加的真实 .png 文件。
|
||||
|
||||
## 使用时机
|
||||
|
||||
- 用户要求制作或生成表情包
|
||||
- 用户想要关于某个话题、情境或吐槽的表情包
|
||||
- 用户说"把这个做成表情包"或类似表达
|
||||
|
||||
## 可用模板
|
||||
|
||||
该脚本支持按名称或 ID 使用 **imgflip 上约 100 个热门模板**,另外还有 10 个经过精心调整文字位置的精选模板。
|
||||
|
||||
### 精选模板(自定义文字位置)
|
||||
|
||||
| ID | 名称 | 字段 | 最适合 |
|
||||
|----|------|--------|----------|
|
||||
| `this-is-fine` | This is Fine | top, bottom | 混乱、否认 |
|
||||
| `drake` | Drake Hotline Bling | reject, approve | 拒绝/偏好 |
|
||||
| `distracted-boyfriend` | Distracted Boyfriend | distraction, current, person | 诱惑、转移注意力 |
|
||||
| `two-buttons` | Two Buttons | left, right, person | 两难抉择 |
|
||||
| `expanding-brain` | Expanding Brain | 4 个层级 | 层层递进的讽刺 |
|
||||
| `change-my-mind` | Change My Mind | statement | 热门观点 |
|
||||
| `woman-yelling-at-cat` | Woman Yelling at Cat | woman, cat | 争论 |
|
||||
| `one-does-not-simply` | One Does Not Simply | top, bottom | 出乎意料的难事 |
|
||||
| `grus-plan` | Gru's Plan | step1-3, realization | 计划反噬 |
|
||||
| `batman-slapping-robin` | Batman Slapping Robin | robin, batman | 驳斥烂主意 |
|
||||
|
||||
### 动态模板(来自 imgflip API)
|
||||
|
||||
不在精选列表中的任何模板均可通过名称或 imgflip ID 使用。这些模板会自动应用智能默认文字位置(2 个字段时为上/下,3 个及以上时均匀分布)。搜索方式:
|
||||
```bash
|
||||
python "$SKILL_DIR/scripts/generate_meme.py" --search "disaster"
|
||||
```
|
||||
|
||||
## 操作流程
|
||||
|
||||
### 模式 1:经典模板(默认)
|
||||
|
||||
1. 读取用户的主题,识别核心动态(混乱、两难、偏好、讽刺等)。
|
||||
2. 选取最匹配的模板。参考"最适合"列,或使用 `--search` 搜索。
|
||||
3. 为每个字段编写简短说明文字(每个字段最多 8-12 个词,越短越好)。
|
||||
4. 找到 skill 的脚本目录:
|
||||
```
|
||||
SKILL_DIR=$(dirname "$(find ~/.hermes/skills -path '*/meme-generation/SKILL.md' 2>/dev/null | head -1)")
|
||||
```
|
||||
5. 运行生成器:
|
||||
```bash
|
||||
python "$SKILL_DIR/scripts/generate_meme.py" <template_id> /tmp/meme.png "caption 1" "caption 2" ...
|
||||
```
|
||||
6. 使用 `MEDIA:/tmp/meme.png` 返回图片。
|
||||
|
||||
### 模式 2:自定义 AI 图片(当 image_generate 可用时)
|
||||
|
||||
当没有合适的经典模板,或用户想要原创内容时使用此模式。
|
||||
|
||||
1. 先编写说明文字。
|
||||
2. 使用 `image_generate` 创建符合表情包概念的场景。图片 prompt(提示词)中**不要包含任何文字** — 文字将由脚本添加。仅描述视觉场景。
|
||||
3. 从 image_generate 结果 URL 中找到生成图片的路径。如有需要,将其下载到本地路径。
|
||||
4. 使用 `--image` 运行脚本叠加文字,选择一种模式:
|
||||
- **Overlay**(文字直接叠加在图片上,白色带黑色描边):
|
||||
```bash
|
||||
python "$SKILL_DIR/scripts/generate_meme.py" --image /path/to/scene.png /tmp/meme.png "top text" "bottom text"
|
||||
```
|
||||
- **Bars**(图片上下方添加黑色条带显示白色文字 — 更整洁,始终可读):
|
||||
```bash
|
||||
python "$SKILL_DIR/scripts/generate_meme.py" --image /path/to/scene.png --bars /tmp/meme.png "top text" "bottom text"
|
||||
```
|
||||
当图片内容复杂/细节丰富、文字叠加后难以辨认时,使用 `--bars`。
|
||||
5. **使用视觉验证**(如果 `vision_analyze` 可用):检查结果是否美观:
|
||||
```
|
||||
vision_analyze(image_url="/tmp/meme.png", question="Is the text legible and well-positioned? Does the meme work visually?")
|
||||
```
|
||||
如果视觉模型发现问题(文字难以辨认、位置不佳等),尝试切换另一种模式(在 overlay 和 bars 之间切换)或重新生成场景。
|
||||
6. 使用 `MEDIA:/tmp/meme.png` 返回图片。
|
||||
|
||||
## 示例
|
||||
|
||||
**"凌晨 2 点调试生产环境":**
|
||||
```bash
|
||||
python generate_meme.py this-is-fine /tmp/meme.png "SERVERS ARE ON FIRE" "This is fine"
|
||||
```
|
||||
|
||||
**"在睡觉和再看一集之间做选择":**
|
||||
```bash
|
||||
python generate_meme.py drake /tmp/meme.png "Getting 8 hours of sleep" "One more episode at 3 AM"
|
||||
```
|
||||
|
||||
**"周一早晨的各个阶段":**
|
||||
```bash
|
||||
python generate_meme.py expanding-brain /tmp/meme.png "Setting an alarm" "Setting 5 alarms" "Sleeping through all alarms" "Working from bed"
|
||||
```
|
||||
|
||||
## 列出模板
|
||||
|
||||
查看所有可用模板:
|
||||
```bash
|
||||
python generate_meme.py --list
|
||||
```
|
||||
|
||||
## 注意事项
|
||||
|
||||
- 说明文字要**简短**。文字过长的表情包效果很差。
|
||||
- 文字参数数量须与模板的字段数量匹配。
|
||||
- 根据笑点结构选择模板,而不仅仅是根据话题。
|
||||
- 不得生成仇恨、辱骂或针对特定个人的内容。
|
||||
- 脚本会在首次下载后将模板图片缓存至 `scripts/.cache/`。
|
||||
|
||||
## 验证
|
||||
|
||||
以下情况说明输出正确:
|
||||
- 在输出路径创建了 .png 文件
|
||||
- 文字在模板上清晰可读(白色带黑色描边)
|
||||
- 笑点成立 — 说明文字与模板的预期结构相符
|
||||
- 文件可通过 MEDIA: 路径传递
|
||||
Reference in New Issue
Block a user