Files
zclaw_openfang/pipelines/README.md
iven 9c781f5f2a
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
feat(pipeline): implement Pipeline DSL system for automated workflows
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>
2026-03-25 00:52:12 +08:00

102 lines
2.4 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# 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: "我可以使用【互动课堂生成器】为你自动生成完整课件..."
```