Some checks failed
CI / Lint & TypeCheck (push) Has been cancelled
CI / Unit Tests (push) Has been cancelled
CI / Build Frontend (push) Has been cancelled
CI / Rust Check (push) Has been cancelled
CI / Security Scan (push) Has been cancelled
CI / E2E Tests (push) Has been cancelled
Add complete Pipeline DSL system including:
- Rust backend (zclaw-pipeline crate) with parser, executor, and state management
- Frontend components: PipelinesPanel, PipelineResultPreview, ClassroomPreviewer
- Pipeline recommender for Agent conversation integration
- 5 pipeline templates: education, marketing, legal, research, productivity
- Documentation for Pipeline DSL architecture
Pipeline DSL enables declarative workflow definitions with:
- YAML-based configuration
- Expression resolution (${inputs.topic}, ${steps.step1.output})
- LLM integration, parallel execution, file export
- Agent smart recommendations in conversations
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
102 lines
2.4 KiB
Markdown
102 lines
2.4 KiB
Markdown
# ZCLAW Pipelines
|
||
|
||
Pipeline 是 ZCLAW 中声明式的自动化工作流定义。每个 Pipeline 描述了完成特定任务所需的一系列步骤。
|
||
|
||
## 目录结构
|
||
|
||
```
|
||
pipelines/
|
||
├── education/ # 教育类 Pipeline
|
||
│ └── classroom.yaml # 互动课堂生成器
|
||
├── marketing/ # 营销类 Pipeline
|
||
│ └── (待添加)
|
||
├── legal/ # 法律类 Pipeline
|
||
│ └── (待添加)
|
||
└── _templates/ # Pipeline 模板
|
||
└── base.yaml # 基础模板
|
||
```
|
||
|
||
## Pipeline DSL
|
||
|
||
### 基本结构
|
||
|
||
```yaml
|
||
apiVersion: zclaw/v1
|
||
kind: Pipeline
|
||
metadata:
|
||
name: my-pipeline
|
||
displayName: 我的 Pipeline
|
||
category: education
|
||
description: Pipeline 功能描述
|
||
spec:
|
||
inputs:
|
||
- name: param1
|
||
type: string
|
||
required: true
|
||
steps:
|
||
- id: step1
|
||
action:
|
||
type: llm_generate
|
||
template: "处理 {{param1}}"
|
||
outputs:
|
||
result: ${steps.step1.output}
|
||
```
|
||
|
||
### 输入类型
|
||
|
||
- `string` - 文本输入
|
||
- `number` - 数字输入
|
||
- `boolean` - 布尔值
|
||
- `select` - 单选下拉
|
||
- `multi-select` - 多选
|
||
- `file` - 文件上传
|
||
- `text` - 多行文本
|
||
|
||
### 动作类型
|
||
|
||
| 动作 | 说明 |
|
||
|------|------|
|
||
| `llm_generate` | LLM 生成 |
|
||
| `parallel` | 并行执行 |
|
||
| `sequential` | 顺序执行 |
|
||
| `condition` | 条件分支 |
|
||
| `skill` | 调用 Skill |
|
||
| `hand` | 调用 Hand |
|
||
| `classroom_render` | 渲染课堂数据 |
|
||
| `file_export` | 导出文件 |
|
||
| `http_request` | HTTP 请求 |
|
||
| `set_var` | 设置变量 |
|
||
| `delay` | 延时 |
|
||
|
||
### 表达式语法
|
||
|
||
Pipeline 支持表达式来引用上下文数据:
|
||
|
||
- `${inputs.xxx}` - 输入参数
|
||
- `${steps.xxx.output}` - 步骤输出
|
||
- `${item}` - 循环当前项 (parallel 内)
|
||
- `${index}` - 循环索引 (parallel 内)
|
||
- `${vars.xxx}` - 自定义变量
|
||
|
||
## 创建新 Pipeline
|
||
|
||
1. 在对应分类目录下创建 `.yaml` 文件
|
||
2. 按照 DSL 规范定义 Pipeline
|
||
3. 在前端 Pipeline 页面测试运行
|
||
|
||
## 用户界面
|
||
|
||
Pipeline 在用户界面中表现为功能卡片:
|
||
- 用户看到的是 Pipeline 的 `displayName` 和 `description`
|
||
- Hands 和 Skills 作为内部实现被隐藏
|
||
- 用户只需填写输入参数,Pipeline 自动执行
|
||
|
||
## Agent 集成
|
||
|
||
Agent 可以识别用户意图并推荐合适的 Pipeline:
|
||
|
||
```
|
||
用户: "帮我做一个关于光合作用的课件"
|
||
Agent: "我可以使用【互动课堂生成器】为你自动生成完整课件..."
|
||
```
|