feat(pipeline): implement Pipeline DSL system for automated workflows
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
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>
This commit is contained in:
195
pipelines/education/classroom.yaml
Normal file
195
pipelines/education/classroom.yaml
Normal file
@@ -0,0 +1,195 @@
|
||||
# ZCLAW Pipeline - Classroom Generator
|
||||
# 互动课堂生成器:输入课题,自动生成完整互动课堂内容
|
||||
|
||||
apiVersion: zclaw/v1
|
||||
kind: Pipeline
|
||||
metadata:
|
||||
name: classroom-generator
|
||||
displayName: 互动课堂生成器
|
||||
category: education
|
||||
description: 输入课题,自动生成结构化大纲、互动场景和课后测验
|
||||
tags:
|
||||
- 教育
|
||||
- 课件
|
||||
- 自动生成
|
||||
icon: 📚
|
||||
author: ZCLAW
|
||||
version: 1.0.0
|
||||
|
||||
spec:
|
||||
# 输入参数定义
|
||||
inputs:
|
||||
- name: topic
|
||||
type: string
|
||||
required: true
|
||||
label: 课题名称
|
||||
placeholder: 例如:牛顿第二定律
|
||||
validation:
|
||||
min_length: 2
|
||||
max_length: 100
|
||||
|
||||
- name: difficulty
|
||||
type: select
|
||||
required: false
|
||||
label: 难度等级
|
||||
default: 中级
|
||||
options:
|
||||
- 初级
|
||||
- 中级
|
||||
- 高级
|
||||
|
||||
- name: scene_count
|
||||
type: number
|
||||
required: false
|
||||
label: 场景数量
|
||||
default: 5
|
||||
validation:
|
||||
min: 1
|
||||
max: 20
|
||||
|
||||
- name: export_formats
|
||||
type: multi-select
|
||||
required: false
|
||||
label: 导出格式
|
||||
default: [html]
|
||||
options:
|
||||
- html
|
||||
- markdown
|
||||
- json
|
||||
|
||||
# 执行步骤
|
||||
steps:
|
||||
# Step 1: 解析课题,生成大纲
|
||||
- id: generate_outline
|
||||
description: 分析课题并生成课程大纲
|
||||
action:
|
||||
type: llm_generate
|
||||
template: |
|
||||
你是一位专业的教育内容设计师。请为以下课题设计一个结构化的课程大纲。
|
||||
|
||||
课题: {{topic}}
|
||||
难度: {{difficulty}}
|
||||
场景数量: {{scene_count}}
|
||||
|
||||
请生成一个 JSON 格式的大纲,包含以下结构:
|
||||
{
|
||||
"title": "课程标题",
|
||||
"description": "课程简介",
|
||||
"outline": {
|
||||
"items": [
|
||||
{"title": "章节1标题", "description": "章节1描述"},
|
||||
{"title": "章节2标题", "description": "章节2描述"}
|
||||
]
|
||||
}
|
||||
}
|
||||
input:
|
||||
topic: ${inputs.topic}
|
||||
difficulty: ${inputs.difficulty}
|
||||
scene_count: ${inputs.scene_count}
|
||||
json_mode: true
|
||||
temperature: 0.7
|
||||
max_tokens: 2000
|
||||
|
||||
# Step 2: 并行生成场景
|
||||
- id: generate_scenes
|
||||
description: 为每个大纲章节生成互动场景
|
||||
action:
|
||||
type: parallel
|
||||
each: ${steps.generate_outline.output.outline.items}
|
||||
max_workers: 4
|
||||
step:
|
||||
id: scene_item
|
||||
action:
|
||||
type: llm_generate
|
||||
template: |
|
||||
为以下课程章节生成一个互动教学场景:
|
||||
|
||||
课题: ${inputs.topic}
|
||||
章节: {{item.title}}
|
||||
章节描述: {{item.description}}
|
||||
难度: ${inputs.difficulty}
|
||||
|
||||
生成 JSON 格式的场景内容:
|
||||
{
|
||||
"title": "场景标题",
|
||||
"content": "场景内容描述",
|
||||
"interaction": {
|
||||
"type": "quiz|discussion|demonstration",
|
||||
"prompt": "互动提示",
|
||||
"options": ["选项1", "选项2"] (如果是 quiz)
|
||||
},
|
||||
"key_points": ["要点1", "要点2", "要点3"]
|
||||
}
|
||||
input:
|
||||
item: ${item}
|
||||
index: ${index}
|
||||
json_mode: true
|
||||
temperature: 0.8
|
||||
max_tokens: 1500
|
||||
|
||||
# Step 3: 生成课后测验
|
||||
- id: generate_quiz
|
||||
description: 根据场景内容生成测验题
|
||||
action:
|
||||
type: llm_generate
|
||||
template: |
|
||||
基于以下课程场景生成一套课后测验:
|
||||
|
||||
课题: ${inputs.topic}
|
||||
场景数量: ${steps.generate_scenes.output | length}
|
||||
|
||||
生成 5 道选择题的 JSON 格式测验:
|
||||
{
|
||||
"questions": [
|
||||
{
|
||||
"question": "问题内容",
|
||||
"options": ["A选项", "B选项", "C选项", "D选项"],
|
||||
"correct": 0,
|
||||
"explanation": "答案解释"
|
||||
}
|
||||
]
|
||||
}
|
||||
input:
|
||||
topic: ${inputs.topic}
|
||||
scene_count: ${steps.generate_scenes.output | length}
|
||||
json_mode: true
|
||||
temperature: 0.6
|
||||
max_tokens: 2000
|
||||
|
||||
# Step 4: 渲染课堂数据
|
||||
- id: render_classroom
|
||||
description: 组装完整的课堂数据结构
|
||||
action:
|
||||
type: classroom_render
|
||||
input: |
|
||||
{
|
||||
"title": ${steps.generate_outline.output.title},
|
||||
"description": ${steps.generate_outline.output.description},
|
||||
"outline": ${steps.generate_outline.output.outline},
|
||||
"scenes": ${steps.generate_scenes.output},
|
||||
"quiz": ${steps.generate_quiz.output}
|
||||
}
|
||||
|
||||
# Step 5: 导出文件
|
||||
- id: export_files
|
||||
description: 导出指定格式的文件
|
||||
action:
|
||||
type: file_export
|
||||
formats: ${inputs.export_formats}
|
||||
input: ${steps.render_classroom.output}
|
||||
|
||||
# 输出映射
|
||||
outputs:
|
||||
classroom_id: ${steps.render_classroom.output.id}
|
||||
title: ${steps.render_classroom.output.title}
|
||||
preview_url: ${steps.render_classroom.output.preview_url}
|
||||
export_files: ${steps.export_files.output}
|
||||
|
||||
# 错误处理
|
||||
on_error: stop
|
||||
|
||||
# 超时设置
|
||||
timeout_secs: 300
|
||||
|
||||
# 并行工作线程上限
|
||||
max_workers: 4
|
||||
Reference in New Issue
Block a user