dify_creator

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Dify 工作流生成器 (dify_creator)

Dify Workflow Generator (dify_creator)

通过多轮对话引导用户明确需求,参考
organized_dsl/
目录中的现有案例
,生成符合对应 Dify 版本规范的 DSL YAML 文件,可直接导入 Dify 使用。
⚠️ 重要:搜索文件前必须先切换到技能目录!
bash
cd "c:\Users\14429\.claude\skills\dify_creator"
然后再搜索
organized_dsl/INDEX.md
organized_dsl/**/*.yml
Guide users to clarify requirements through multi-round conversations, refer to existing cases in the
organized_dsl/
directory
, and generate DSL YAML files that comply with the corresponding Dify version specifications, which can be directly imported into Dify for use.
⚠️ Important: You must switch to the skill directory before searching for files!
bash
cd "c:\Users\14429\.claude\skills\dify_creator"
Then search for
organized_dsl/INDEX.md
and
organized_dsl/**/*.yml

核心能力

Core Capabilities

  • 智能对话引导:通过提问帮助用户梳理需求,避免遗漏关键信息
  • 案例参考定位:基于 INDEX.md 索引,自动匹配相似 Dify 案例
  • 工作流结构设计:分析需求后给出流程结构,与用户确认
  • 完整 DSL 生成:参考 DSL 节点指南,生成符合规范的完整 YAML 配置
  • Intelligent Conversation Guidance: Help users sort out requirements through questions to avoid missing key information
  • Case Reference Location: Automatically match similar Dify cases based on the INDEX.md index
  • Workflow Structure Design: Provide a process structure after analyzing requirements and confirm with users
  • Complete DSL Generation: Generate complete YAML configurations that meet specifications by referring to the DSL Node Guide

使用场景

Use Cases

  • 创建智能客服对话流程
  • 构建 RAG 知识库问答系统
  • 设计音视频处理工作流
  • 开发代码生成和文档处理工具
  • 搭建多模型协作的复杂流程

  • Create intelligent customer service conversation flows
  • Build RAG knowledge base question answering systems
  • Design audio and video processing workflows
  • Develop code generation and document processing tools
  • Build complex workflows with multi-model collaboration

工作流程总览

Workflow Overview

用户需求 → 案例定位 → 流程设计 → 用户确认 → DSL生成 → 交付
User Requirements → Case Location → Process Design → User Confirmation → DSL Generation → Delivery

核心步骤

Core Steps

步骤名称输出
Step 1收集需求需求文档
Step 2案例定位参考案例列表
Step 3流程设计流程结构图
Step 4用户确认确认反馈
Step 5DSL生成完整YAML文件

StepNameOutput
Step 1Requirement CollectionRequirement Document
Step 2Case LocationReference Case List
Step 3Process DesignProcess Structure Diagram
Step 4User ConfirmationConfirmation Feedback
Step 5DSL GenerationComplete YAML File

Step 1:收集用户需求

Step 1: Collect User Requirements

首先向用户询问基础信息,明确工作流的目标和功能。
First, ask users for basic information to clarify the goals and functions of the workflow.

1.1 基础信息收集

1.1 Basic Information Collection

markdown
请告诉我关于你要创建的 Dify 工作流的基本信息:

1. **工作流名称**(英文,使用连字符,如:document-processor)
2. **一句话描述**:这个工作流做什么?
3. **应用类型**   - workflow:批处理任务,单轮执行
   - advanced-chat:高级聊天模式,支持多轮对话
   - chatflow:对话式应用,简单多轮交互
4. **目标用户**:谁会使用这个工作流?
markdown
Please tell me the basic information about the Dify workflow you want to create:

1. **Workflow Name** (English, use hyphens, e.g., document-processor)
2. **One-sentence Description**: What does this workflow do?
3. **Application Type**:
   - workflow: Batch processing task, single-round execution
   - advanced-chat: Advanced chat mode, supports multi-round conversations
   - chatflow: Conversational application, simple multi-round interaction
4. **Target Users**: Who will use this workflow?

1.2 功能需求收集

1.2 Functional Requirement Collection

根据用户选择的应用类型,深入询问功能需求:
通用问题:
markdown
5. **输入方式**:用户如何提供输入?
   - 文本输入(短文本/长文本)
   - 文件上传(图片/PDF/音视频/文档)
   - 混合输入

6. **核心处理**:工作流需要执行哪些处理步骤?
   - 数据预处理 → 核心处理 → 结果输出
   - 请尽可能描述每个步骤

7. **输出形式**:最终返回什么结果?
   - 文本回复
   - 结构化数据(JSON/Markdown表格)
   - 文件(图片/PDF/音频)
   - 混合输出
根据功能类型补充:
功能类型补充问题
RAG问答知识库来源?检索策略(关键词/向量)?召回数量?是否需要重排序?
音视频处理音频提取?语音识别(ASR)?内容总结?字幕生成?
文档处理PDF解析?内容提取?格式转换?OCR识别?
图像生成文生图?图生图?风格迁移?是否需要多图组合?
数据处理数据来源(API/数据库/文件)?分析维度?图表类型?
工具调用使用哪些工具/插件?调用频率?是否需要MCP?
多模型协作调用哪些模型?分工是什么?模型间如何传递信息?
Based on the application type selected by the user, ask in-depth functional requirements:
General Questions:
markdown
5. **Input Method**: How will users provide input?
   - Text input (short text/long text)
   - File upload (image/PDF/audio-video/document)
   - Mixed input

6. **Core Processing**: What processing steps does the workflow need to perform?
   - Data preprocessing → Core processing → Result output
   - Please describe each step as much as possible

7. **Output Format**: What results will be returned finally?
   - Text response
   - Structured data (JSON/Markdown table)
   - File (image/PDF/audio)
   - Mixed output
Supplementary Questions by Function Type:
Function TypeSupplementary Questions
RAG Q&AKnowledge base source? Retrieval strategy (keyword/vector)? Number of recalls? Is re-ranking needed?
Audio-Video ProcessingAudio extraction? Speech recognition (ASR)? Content summarization? Subtitle generation?
Document ProcessingPDF parsing? Content extraction? Format conversion? OCR recognition?
Image GenerationText-to-image? Image-to-image? Style transfer? Is multi-image combination needed?
Data ProcessingData source (API/database/file)? Analysis dimensions? Chart type?
Tool CallingWhich tools/plugins are used? Calling frequency? Is MCP needed?
Multi-Model CollaborationWhich models are called? What are their divisions of labor? How do models transfer information between each other?

1.3 模型和工具配置

1.3 Model and Tool Configuration

markdown
8. **大模型选择**   - 模型提供商:OpenAI / Anthropic / 国内模型(硅基流动/通义千问/零一万物等)
   - 模型名称:如 gpt-4o, deepseek-V3, qwen-max
   - 参数设置:temperature(创意度 0-1)、max_tokens 等

9. **工具/插件**   - 内置工具:代码执行、知识检索、HTTP请求、TTS等
   - 第三方插件:PDF处理、数据库连接等
   - MCP服务:是否需要集成外部MCP工具?

10. **知识库(可选)**    - 是否需要接入知识库?
    - 知识库ID和名称
    - 检索策略配置
markdown
8. **Large Model Selection**:
   - Model Provider: OpenAI / Anthropic / Domestic Models (SiliconFlow/Qwen/ZeroOneAI, etc.)
   - Model Name: e.g., gpt-4o, deepseek-V3, qwen-max
   - Parameter Settings: temperature (creativity 0-1), max_tokens, etc.

9. **Tools/Plugins**:
   - Built-in Tools: Code execution, knowledge retrieval, HTTP request, TTS, etc.
   - Third-party Plugins: PDF processing, database connection, etc.
   - MCP Service: Is external MCP tool integration needed?

10. **Knowledge Base (Optional)**:
    - Is knowledge base access needed?
    - Knowledge Base ID and Name
    - Retrieval Strategy Configuration

1.4 流程控制询问

1.4 Process Control Inquiry

markdown
11. **流程分支**:是否有条件分支?(是/否)
    - 如果是,分支条件是什么?(例如:根据用户意图分类走不同处理路径)
12. **循环处理**:是否需要迭代处理批量数据?(是/否)
    - 例如:批量处理多个文件、对列表中每项进行处理
13. **会话状态**:是否需要保存会话状态?(是/否)
    - 例如:记录用户偏好、跨轮次变量传递
14. **错误处理**:失败时如何处理?
    - 终止流程并报错
    - 继续执行其他分支
    - 返回默认结果

markdown
11. **Process Branches**: Are there conditional branches? (Yes/No)
    - If yes, what are the branch conditions? (e.g., different processing paths based on user intent classification)
12. **Loop Processing**: Is iterative processing of batch data needed? (Yes/No)
    - e.g., Batch processing multiple files, processing each item in a list
13. **Session State**: Is session state preservation needed? (Yes/No)
    - e.g., Recording user preferences, cross-round variable transfer
14. **Error Handling**: How to handle failures?
    - Terminate the process and report an error
    - Continue executing other branches
    - Return default results

Step 2:案例定位(基于 INDEX.md)

Step 2: Case Location (Based on INDEX.md)

根据收集的需求,在
organized_dsl/INDEX.md
中定位相似案例。
Locate similar cases in
organized_dsl/INDEX.md
based on the collected requirements.

2.0 搜索路径配置

2.0 Search Path Configuration

markdown
⚠️ **关键步骤:搜索前必须先切换到技能目录!**

**第一步:切换到技能目录(必须执行)**
```bash
cd "c:\Users\14429\.claude\skills\dify_creator"
第二步:搜索 DSL 文件
  • 搜索
    organized_dsl/**/*.yml
    (在技能目录下搜索)
第三步:搜索索引文件
  • 搜索
    organized_dsl/INDEX.md
  • 搜索
    organized_dsl/Dify_DSL_节点完整参考指南.md
错误做法:
  • ❌ 直接搜索
    **/*.yml
    (当前目录可能不对)
  • ❌ 搜索
    **/organized_dsl/**/*.yml
    (路径重复)
  • ❌ 搜索
    **/*.yaml
    (文件是 .yml 不是 .yaml)
  • ❌ 在其他目录下搜索
    organized_dsl/**/*.yml
    (会找不到)
正确做法:
  1. 先执行
    cd "c:\Users\14429\.claude\skills\dify_creator"
  2. 再搜索
    organized_dsl/**/*.yml
  3. 再搜索
    organized_dsl/INDEX.md
undefined
markdown
⚠️ **Critical Step: You must switch to the skill directory before searching!**

**Step 1: Switch to the skill directory (Mandatory)**
```bash
cd "c:\Users\14429\.claude\skills\dify_creator"
Step 2: Search for DSL Files
  • Search for
    organized_dsl/**/*.yml
    (search in the skill directory)
Step 3: Search for Index Files
  • Search for
    organized_dsl/INDEX.md
  • Search for
    organized_dsl/Dify_DSL_Complete Node Reference Guide.md
Incorrect Practices:
  • ❌ Directly search
    **/*.yml
    (current directory may be incorrect)
  • ❌ Search
    **/organized_dsl/**/*.yml
    (duplicate path)
  • ❌ Search
    **/*.yaml
    (files are .yml not .yaml)
  • ❌ Search
    organized_dsl/**/*.yml
    in other directories (will not find files)
Correct Practices:
  1. First execute
    cd "c:\Users\14429\.claude\skills\dify_creator"
  2. Then search
    organized_dsl/**/*.yml
  3. Then search
    organized_dsl/INDEX.md
undefined

2.1 读取 INDEX.md 索引

2.1 Read INDEX.md Index

首先读取索引文件了解案例分类:
markdown
1. 搜索并读取 `organized_dsl/INDEX.md`
2. 根据用户需求的功能类型,定位相关分类目录
3. 在对应目录中搜索相似功能的 DSL 案例(使用 `organized_dsl/**/*.yml`
First read the index file to understand case classifications:
markdown
1. Search and read `organized_dsl/INDEX.md`
2. Locate relevant classification directories based on the functional type of user requirements
3. Search for DSL cases with similar functions in the corresponding directory (using `organized_dsl/**/*.yml`)

2.2 分类定位

2.2 Classification Location

根据功能类型查找对应目录:
markdown
根据你的需求,我定位到以下相关分类:

| 分类 | 目录路径 |
|------|----------|
| 内容创作 | `01_内容生成与创作/` |
| 图像生成 | `02_图像生成与设计/` |
| 视频生成 | `03_视频生成/` |
| 数据分析 | `04_数据分析与可视化/` |
| 文档处理 | `05_文档处理与OCR/` |
| 知识库RAG | `06_知识库与RAG/` |
| Agent工具 | `07_Agent与工具调用/` |
| 教育学习 | `08_教育与学习/` |
| 商业办公 | `09_商业与办公/` |
| 多媒体处理 | `10_多媒体处理/` |
| 代码开发 | `11_代码与开发/` |
| 创意娱乐 | `12_创意与娱乐/` |
Find the corresponding directory based on functional type:
markdown
Based on your requirements, I have located the following relevant classifications:

| Classification | Directory Path |
|------|----------|
| Content Creation | `01_Content_Generation_Creation/` |
| Image Generation | `02_Image_Generation_Design/` |
| Video Generation | `03_Video_Generation/` |
| Data Analysis | `04_Data_Analysis_Visualization/` |
| Document Processing | `05_Document_Processing_OCR/` |
| Knowledge Base RAG | `06_Knowledge_Base_RAG/` |
| Agent Tools | `07_Agent_Tool_Calling/` |
| Education & Learning | `08_Education_Learning/` |
| Business & Office | `09_Business_Office/` |
| Multimedia Processing | `10_Multimedia_Processing/` |
| Code Development | `11_Code_Development/` |
| Creative Entertainment | `12_Creative_Entertainment/` |

2.3 复杂度匹配

2.3 Complexity Matching

根据节点数量匹配复杂度:
复杂度节点数适用场景
简单3-5个单一功能,线性流程
中等6-15个多步骤处理,有分支
复杂16+个多模块协作,循环处理
Match complexity based on the number of nodes:
ComplexityNumber of NodesApplicable Scenarios
Simple3-5Single function, linear process
Medium6-15Multi-step processing, with branches
Complex16+Multi-module collaboration, loop processing

2.4 输出参考案例列表

2.4 Output Reference Case List

markdown
找到以下与你需求相关的参考案例:
markdown
The following reference cases related to your requirements have been found:

📂 案例1:[案例名称]

📂 Case 1: [Case Name]

  • 位置
    目录路径/文件名.yml
  • 复杂度:简单/中等/复杂
  • 节点数:X个
  • 主要节点:start → llm → answer
  • 参考价值:节点结构、Prompt模板、流程设计
  • Location:
    directory-path/file-name.yml
  • Complexity: Simple/Medium/Complex
  • Number of Nodes: X
  • Main Nodes: start → llm → answer
  • Reference Value: Node structure, Prompt template, process design

📂 案例2:[案例名称]

📂 Case 2: [Case Name]

...
请确认:
  • 是否需要查看更多相似案例?
  • 哪些案例的结构最符合你的需求?
undefined
...
Please confirm:
  • Do you need to view more similar cases?
  • Which cases have the structure that best meets your requirements?
undefined

2.5 读取并分析参考案例

2.5 Read and Analyze Reference Cases

选定参考案例后,读取 DSL 文件进行分析:
markdown
我已读取参考案例,以下是关键配置提取:

**节点结构:**
[开始节点] ↓ [LLM节点] - 模型: xxx, Prompt: xxx ↓ [工具节点] - 工具: xxx ↓ [输出节点]

**关键配置参考:**
- LLM prompt模板:...
- 变量传递方式:...
- 条件分支逻辑:...

After selecting reference cases, read the DSL files for analysis:
markdown
I have read the reference cases, and here is the key configuration extraction:

**Node Structure:**
[Start Node] ↓ [LLM Node] - Model: xxx, Prompt: xxx ↓ [Tool Node] - Tool: xxx ↓ [Output Node]

**Key Configuration References:**
- LLM prompt template: ...
- Variable transfer method: ...
- Conditional branch logic: ...

Step 3:工作流结构设计

Step 3: Workflow Structure Design

根据需求分析和参考案例,设计工作流结构。
Design the workflow structure based on requirement analysis and reference cases.

3.1 设计原则

3.1 Design Principles

  1. KISS原则:保持简单,避免过度设计
  2. 模块化:将复杂流程拆分为可复用的步骤
  3. 清晰变量:使用有意义的变量名,便于追踪
  1. KISS Principle: Keep it simple, avoid over-engineering
  2. Modularity: Split complex processes into reusable steps
  3. Clear Variables: Use meaningful variable names for easy tracking

3.2 输出流程结构图

3.2 Output Process Structure Diagram

markdown
根据你的需求,我设计了以下工作流结构:
markdown
Based on your requirements, I have designed the following workflow structure:

📊 流程结构图

📊 Process Structure Diagram

┌─────────────┐
│   开始节点   │  输入:{{input_var}}
└──────┬──────┘
┌─────────────┐
│  预处理节点  │  功能:数据清洗/格式转换
└──────┬──────┘
┌─────────────┐
│   核心处理   │  功能:LLM调用/工具执行
│   (分支判断) │  条件:{{condition}}
└──────┬──────┘
   ┌────┴────┐
   ↓         ↓
┌──────┐  ┌──────┐
│分支A │  │分支B │
└────┬─┘  └────┬─┘
   │          │
   └────┬─────┘
┌─────────────┐
│   结果处理   │  功能:格式化/聚合
└──────┬──────┘
┌─────────────┐
│   输出节点   │  输出:{{output_var}}
└─────────────┘
┌─────────────┐
│   Start Node   │  Input: {{input_var}}
└──────┬──────┘
┌─────────────┐
│  Preprocessing Node  │  Function: Data cleaning/format conversion
└──────┬──────┘
┌─────────────┐
│   Core Processing   │  Function: LLM calling/tool execution
│   (Branch Judgment) │  Condition: {{condition}}
└──────┬──────┘
   ┌────┴────┐
   ↓         ↓
┌──────┐  ┌──────┐
│Branch A │  │Branch B │
└────┬─┘  └────┬─┘
   │          │
   └────┬─────┘
┌─────────────┐
│   Result Processing   │  Function: Formatting/aggregation
└──────┬──────┘
┌─────────────┐
│   Output Node   │  Output: {{output_var}}
└─────────────┘

📋 节点列表

📋 Node List

序号节点名称节点类型功能描述输入变量输出变量
1开始start接收用户输入-user_input
2预处理code数据清洗user_inputclean_data
3LLM处理llm生成内容clean_datallm_result
4条件判断if-else分支处理llm_resultbranch
5输出answer返回结果final_result-
Serial NumberNode NameNode TypeFunction DescriptionInput VariablesOutput Variables
1StartstartReceive user input-user_input
2PreprocessingcodeData cleaninguser_inputclean_data
3LLM ProcessingllmContent generationclean_datallm_result
4Condition Judgmentif-elseBranch processingllm_resultbranch
5OutputanswerReturn resultsfinal_result-

📝 关键配置

📝 Key Configurations

LLM配置:
  • 模型:xxx
  • Prompt模板:xxx
变量传递:
  • 上游输出 → 下游输入

---
LLM Configuration:
  • Model: xxx
  • Prompt template: xxx
Variable Transfer:
  • Upstream output → Downstream input

---

Step 4:用户确认(⚠️ 必须步骤)

Step 4: User Confirmation (⚠️ Mandatory Step)

警告:未获得用户明确确认前,禁止生成 DSL!
向用户展示结构设计,必须获取以下确认后才能继续:
Warning: Do NOT generate DSL without explicit user confirmation!
Show the structure design to users, and you must obtain the following confirmations before proceeding:

4.1 确认内容

4.1 Confirmation Content

markdown
undefined
markdown
undefined

工作流结构确认 ⚠️

Workflow Structure Confirmation ⚠️

在生成 DSL 文件之前,请确认以下设计:
Before generating the DSL file, please confirm the following design:

✅ 流程结构

✅ Process Structure

  • 节点数量:X 个
  • 流程分支:X 条
  • 循环处理:X 处
  • Number of Nodes: X
  • Process Branches: X
  • Loop Processing: X

✅ 节点配置

✅ Node Configuration

  1. [节点1]:确认配置 ✓
  2. [节点2]:需要调整 →
  3. [节点3]:确认配置 ✓
  1. [Node 1]: Configuration confirmed ✓
  2. [Node 2]: Need adjustment →
  3. [Node 3]: Configuration confirmed ✓

✅ 待确认事项

✅ Items to Confirm

  1. 模型选择是否正确?
  2. Prompt模板是否需要调整?
  3. 分支条件是否合理?
  4. 输出格式是否满足需求?
请回复「确认」或「继续」以生成 DSL,或提供修改意见。
undefined
  1. Is the model selection correct?
  2. Does the Prompt template need adjustment?
  3. Are the branch conditions reasonable?
  4. Does the output format meet requirements?
Please reply with "Confirm" or "Continue" to generate the DSL, or provide modification suggestions.
undefined

4.2 确认检查清单

4.2 Confirmation Checklist

markdown
生成 DSL 前必须确认以下全部项目:

- [ ] 用户明确回复「确认」或「继续」
- [ ] 所有节点配置已与用户核对
- [ ] 模型和参数已获用户认可
- [ ] 输出格式符合用户需求

**未满足上述条件,禁止跳到 Step 5!**
markdown
The following items must be confirmed before generating the DSL:

- [ ] User explicitly replied "Confirm" or "Continue"
- [ ] All node configurations have been checked with the user
- [ ] Model and parameters have been approved by the user
- [ ] Output format meets user requirements

**If the above conditions are not met, do NOT proceed to Step 5!**

4.3 调整迭代

4.3 Adjustment and Iteration

如果用户有修改意见,迭代调整直到确认:
markdown
根据你的反馈,我进行了以下调整:

1. 修改了 LLM 节点 Prompt 模板
2. 添加了新的条件分支
3. 调整了变量传递逻辑

请再次确认。

If the user has modification suggestions, iterate and adjust until confirmed:
markdown
Based on your feedback, I have made the following adjustments:

1. Modified the LLM node Prompt template
2. Added new conditional branches
3. Adjusted variable transfer logic

Please confirm again.

Step 5:生成完整 DSL(⚠️ 必须参考案例)

Step 5: Generate Complete DSL (⚠️ Must Reference Cases)

生成 DSL 前必须完成以下步骤:
  1. ✅ 已切换到技能目录:
    cd "c:\Users\14429\.claude\skills\dify_creator"
  2. ✅ 已在 Step 2 中读取并分析了参考案例
  3. ✅ 已在 Step 4 中获得用户明确确认
  4. ✅ 已读取
    organized_dsl/Dify_DSL_节点完整参考指南.md
The following steps must be completed before generating the DSL:
  1. ✅ Switched to the skill directory:
    cd "c:\Users\14429\.claude\skills\dify_creator"
  2. ✅ Read and analyzed reference cases in Step 2
  3. ✅ Obtained explicit user confirmation in Step 4
  4. ✅ Read
    organized_dsl/Dify_DSL_Complete Node Reference Guide.md

5.1 前置检查

5.1 Pre-Check

markdown
生成 DSL 前确认:

- [ ] 已选定参考案例文件(路径:xxx/xxx.yml)
- [ ] 已读取节点配置参考指南
- [ ] 已获得用户「确认」回复
- [ ] 所有节点配置已确定

**未完成以上步骤,禁止生成 DSL!**
markdown
Confirmation before generating DSL:

- [ ] Selected reference case file (Path: xxx/xxx.yml)
- [ ] Read the node configuration reference guide
- [ ] Obtained user's "Confirm" reply
- [ ] All node configurations have been determined

**If the above steps are not completed, do NOT generate the DSL!**

5.2 生成结构

5.2 Generation Structure

yaml
app:
  description: '{{description}}'
  icon: '{{icon}}'
  icon_background: '{{icon_background}}'
  mode: '{{mode}}'
  name: '{{name}}'
  use_icon_as_answer_icon: false
kind: app
version: {{参考案例的版本号}}
workflow:
  conversation_variables: []
  environment_variables: []
  features:
    file_upload: {}
    # ... 其他功能配置
  graph:
    edges: []
    nodes: []
  viewport: {}
yaml
app:
  description: '{{description}}'
  icon: '{{icon}}'
  icon_background: '{{icon_background}}'
  mode: '{{mode}}'
  name: '{{name}}'
  use_icon_as_answer_icon: false
kind: app
version: {{version-number-of-reference-case}}
workflow:
  conversation_variables: []
  environment_variables: []
  features:
    file_upload: {}
    # ... Other function configurations
  graph:
    edges: []
    nodes: []
  viewport: {}

5.3 节点 ID 生成规则

5.3 Node ID Generation Rules

  • 使用时间戳+随机数作为节点 ID
  • 格式:
    {时间戳}{随机6位数字}
  • 示例:
    1741011655068
    ,
    1735195133945
  • Use timestamp + random number as node ID
  • Format:
    {timestamp}{6-digit-random-number}
  • Example:
    1741011655068
    ,
    1735195133945

5.4 位置计算

5.4 Position Calculation

节点在画布上的位置根据流程顺序自动计算:
  • X 坐标:每增加一个节点向右移动约 300px
  • Y 坐标:统一居中或根据分支调整
The position of nodes on the canvas is automatically calculated according to the process order:
  • X coordinate: Move approximately 300px to the right for each additional node
  • Y coordinate: Centered uniformly or adjusted according to branches

5.5 完整输出示例

5.5 Complete Output Example

yaml
undefined
yaml
undefined

============================================

============================================

Dify 工作流 DSL 文件

Dify Workflow DSL File

名称:xxx

Name: xxx

生成时间:2026-01-03

Generation Time: 2026-01-03

参考案例:xxx.yml

Reference Case: xxx.yml

============================================

============================================

app: description: '工作流描述' icon: 🤖 icon_background: '#FFEAD5' mode: workflow name: xxx kind: app version: {{参考案例的版本号}} workflow: graph: edges: # ... 连接配置 nodes: # ... 节点配置
undefined
app: description: 'Workflow Description' icon: 🤖 icon_background: '#FFEAD5' mode: workflow name: xxx kind: app version: {{version-number-of-reference-case}} workflow: graph: edges: # ... Connection configurations nodes: # ... Node configurations
undefined

⚠️ 5.6 节点编写规则(重要!)

⚠️ 5.6 Node Writing Rules (Important!)

每个节点都必须参考 organized_dsl 案例库中的示例格式编写!
markdown
生成工作流时,请严格遵循以下规则:

1. **先查找参考案例**
   - 搜索 `organized_dsl/**/*.yml` 找到相似功能的 DSL 文件
   - 搜索 `organized_dsl/Dify_DSL_节点完整参考指南.md` 查看节点配置说明

2. **节点结构必须完整**
   每个节点必须包含:
   - `id`: 唯一标识
   - `data.type`: 节点类型
   - `data.title`: 节点标题
   - `position`: 画布位置 {x, y}
   - `width`/`height`: 节点尺寸(可选)

3. **禁止凭空编写**
   - ❌ 不要凭记忆或想象编写节点
   - ✅ 必须复制参考案例的结构,替换关键字段

4. **特别注意事项**
   - **迭代节点**:必须包含 iteration-start 子节点和所有必要标记
   - **LLM 节点**:必须包含 model.provider、model.name、prompt_template
   - **HTTP 请求**:必须包含正确的 authorization 和 body 配置
   - **变量引用**:必须使用 `{{#节点ID.变量#}}` 格式
Each node must be written by strictly following the examples in the organized_dsl case library!
markdown
When generating workflows, please strictly follow the following rules:

1. **First Find Reference Cases**
   - Search `organized_dsl/**/*.yml` to find DSL files with similar functions
   - Search `organized_dsl/Dify_DSL_Complete Node Reference Guide.md` to view node configuration instructions

2. **Node Structure Must Be Complete**
   Each node must include:
   - `id`: Unique identifier
   - `data.type`: Node type
   - `data.title`: Node title
   - `position`: Canvas position {x, y}
   - `width`/`height`: Node size (optional)

3. **Do NOT Write from Scratch**
   - ❌ Do not write nodes based on memory or imagination
   - ✅ Must copy the structure of reference cases and replace key fields

4. **Special Notes**
   - **Iteration Nodes**: Must include iteration-start sub-node and all necessary markers
   - **LLM Nodes**: Must include model.provider, model.name, prompt_template
   - **HTTP Requests**: Must include correct authorization and body configurations
   - **Variable References**: Must use the format `{{#node-id.variable#}}`

⚠️ 5.7 生成后强制检查(❗必须执行)

⚠️ 5.7 Mandatory Post-Generation Check (❗Must Execute)

生成 DSL 后,必须按以下步骤强制检查每个节点!
markdown
undefined
After generating the DSL, you must check each node step by step according to the following steps!
markdown
undefined

DSL 生成后强制检查 ⚠️

Mandatory Post-Generation DSL Check ⚠️

警告:未完成检查,禁止交付给用户!
Warning: Do NOT deliver to users without completing the check!

第一步:确定版本号

Step 1: Confirm Version Number

yaml
version: {{参考案例的版本号}}  # ✅ 与参考案例保持一致
要点: 版本号应与所选参考案例保持一致,不是固定值。
yaml
version: {{version-number-of-reference-case}}  # ✅ Consistent with reference case
Key Point: The version number should be consistent with the selected reference case, not a fixed value.

第二步:遍历每个节点,逐一对照参考案例检查

Step 2: Traverse Each Node and Check Against Reference Cases One by One

对于每个生成的节点,执行以下检查:
  1. 在参考案例中找到同类型节点
    bash
    cd "c:\Users\14429\.claude\skills\dify_creator"
    rg "type: 节点类型" organized_dsl/**/*.yml | head -20
  2. 读取参考案例中的节点结构
    • 打开对应的 DSL 文件
    • 找到相同类型的节点配置
  3. 逐字段对比
    字段参考案例生成结果是否正确
    data.positionAbsolutefalse?
    data.selectedfalse?
    height52?
    width242?
    .........
  4. 标记差异并修正
    • 发现任何差异,立即修正
    • 不能确定的字段,参考案例使用原值
For each generated node, perform the following checks:
  1. Find nodes of the same type in reference cases
    bash
    cd "c:\Users\14429\.claude\skills\dify_creator"
    rg "type: node-type" organized_dsl/**/*.yml | head -20
  2. Read the node structure in reference cases
    • Open the corresponding DSL file
    • Find the node configuration of the same type
  3. Field-by-field Comparison
    FieldReference CaseGenerated ResultCorrect?
    data.positionAbsolutefalse?
    data.selectedfalse?
    height52?
    width242?
    ............
  4. Mark Differences and Correct
    • If any difference is found, correct it immediately
    • For uncertain fields, use the original value from the reference case

第三步:边连接检查

Step 3: Edge Connection Check

遍历每条边,检查以下字段:
  • data.sourceType
    : 源节点类型
  • data.targetType
    : 目标节点类型
  • data.selected
    : false
  • data.isInIteration
    : false(迭代外)
  • type
    : custom/true/false/isInIteration
Traverse each edge and check the following fields:
  • data.sourceType
    : Source node type
  • data.targetType
    : Target node type
  • data.selected
    : false
  • data.isInIteration
    : false (outside iteration)
  • type
    : custom/true/false/isInIteration

第四步:特殊节点重点检查

Step 4: Focused Check for Special Nodes

节点类型检查重点
variable-aggregator
output_type
+
variables
数组(不是 outputs/formatter_template)
end
type: end
+
outputs
(不是 type: answer)
iteration
start_node_id
指向 iteration-start
llm
model.provider
,
model.name
,
prompt_template
http-request
authorization
,
body
配置完整
Node TypeCheck Focus
variable-aggregator
output_type
+
variables
array (not outputs/formatter_template)
end
type: end
+
outputs
(not type: answer)
iteration
start_node_id
points to iteration-start
llm
model.provider
,
model.name
,
prompt_template
http-request
authorization
,
body
configurations are complete

第五步:检查报告

Step 5: Inspection Report

markdown
undefined
markdown
undefined

DSL 检查报告

DSL Inspection Report

节点检查结果

Node Inspection Results

节点ID节点类型检查状态问题
xxxstart✅ 通过
xxxllm❌ 失败缺少 model.provider
Node IDNode TypeInspection StatusIssue
xxxstart✅ PassedNone
xxxllm❌ FailedMissing model.provider

边检查结果

Edge Inspection Results

边ID类型检查状态问题
xxxcustom✅ 通过
Edge IDTypeInspection StatusIssue
xxxcustom✅ PassedNone

最终结论

Final Conclusion

  • 所有节点检查通过
  • 所有边检查通过
  • 无需修正,可以交付

**检查不通过的处理:**
1. 定位问题节点
2. 读取参考案例
3. 修正节点配置
4. 重新检查直到通过

  • All nodes passed inspection
  • All edges passed inspection
  • No corrections needed, ready for delivery

**Handling of Failed Inspections:**
1. Locate the problematic node
2. Read the reference case
3. Correct the node configuration
4. Re-check until passed

Dify DSL 结构规范

Dify DSL Structure Specifications

完整结构模板

Complete Structure Template

yaml
app:
  description: '应用描述'
  icon: 🤖
  icon_background: '#FFEAD5'
  mode: workflow|advanced-chat|chatflow
  name: 应用名称
  use_icon_as_answer_icon: false
kind: app
version: {{参考案例的版本号}}
workflow:
  conversation_variables: []   # 会话变量
  environment_variables: []    # 环境变量
  features:
    file_upload:               # 文件上传配置
      enabled: false
      # ... 详细配置
    opening_statement: ''      # 开场白
    retriever_resource:        # 检索资源
      enabled: true
    text_to_speech:            # TTS配置
      enabled: false
  graph:
    edges: []                  # 连线列表
    nodes: []                  # 节点列表
  viewport:                    # 视图位置
    x: 0
    y: 0
    zoom: 1
dependencies: []               # 插件依赖
yaml
app:
  description: 'Application Description'
  icon: 🤖
  icon_background: '#FFEAD5'
  mode: workflow|advanced-chat|chatflow
  name: Application Name
  use_icon_as_answer_icon: false
kind: app
version: {{version-number-of-reference-case}}
workflow:
  conversation_variables: []   # Session variables
  environment_variables: []    # Environment variables
  features:
    file_upload:               # File upload configuration
      enabled: false
      # ... Detailed configuration
    opening_statement: ''      # Opening statement
    retriever_resource:        # Retrieval resource
      enabled: true
    text_to_speech:            # TTS configuration
      enabled: false
  graph:
    edges: []                  # Connection list
    nodes: []                  # Node list
  viewport:                    # View position
    x: 0
    y: 0
    zoom: 1
dependencies: []               # Plugin dependencies

节点类型说明

Node Type Description

节点类型用途关键配置
start
开始节点variables(输入变量定义)
llm
大语言模型model、prompt_template、vision、context
answer
Chatflow 直接回复answer(输出模板),仅用于对话式应用
knowledge-retrieval
知识库检索dataset_ids、query_variable_selector
tool
工具调用provider_id、tool_name、tool_parameters
code
代码执行code、code_language、outputs、variables
http-request
HTTP请求method、url、authorization、body
if-else
条件分支cases(条件判断)
template-transform
模板转换template、variables
assigner
写入会话变量items、write_mode
variable-aggregator
聚合多分支输出variables、output_type(不是简单整合!)
iteration
⚠️ 循环处理iterator_selector、output_selector、start_node_id(必填!)
document-extractor
文档提取variable_selector、is_array_file
agent
智能体agent_parameters、agent_strategy_name
end
Workflow 结束节点outputs(输出变量),仅用于工作流
Node TypePurposeKey Configurations
start
Start nodevariables (input variable definitions)
llm
Large language modelmodel, prompt_template, vision, context
answer
Chatflow direct replyanswer (output template), only for conversational applications
knowledge-retrieval
Knowledge base retrievaldataset_ids, query_variable_selector
tool
Tool callingprovider_id, tool_name, tool_parameters
code
Code executioncode, code_language, outputs, variables
http-request
HTTP requestmethod, url, authorization, body
if-else
Conditional branchcases (condition judgment)
template-transform
Template transformationtemplate, variables
assigner
Write to session variablesitems, write_mode
variable-aggregator
Aggregate multi-branch outputsvariables, output_type (not simple integration!)
iteration
⚠️ Loop processingiterator_selector, output_selector, start_node_id (required!)
document-extractor
Document extractionvariable_selector, is_array_file
agent
Agentagent_parameters, agent_strategy_name
end
Workflow end nodeoutputs (output variables), only for workflows

变量引用语法

Variable Reference Syntax

yaml
undefined
yaml
undefined

引用格式:{{#节点ID.输出字段#}}

Reference format: {{#node-id.output-field#}}

引用开始节点的输入

Reference input from start node

{{#1742961448129.file#}}
{{#1742961448129.file#}}

引用 LLM 节点的文本输出

Reference text output from LLM node

{{#1742965550311.text#}}
{{#1742965550311.text#}}

引用 Code 节点的自定义输出

Reference custom output from Code node

{{#1747670104835.result#}}
{{#1747670104835.result#}}

引用会话变量

Reference session variable

{{#conversation.status#}}
{{#conversation.status#}}

引用环境变量

Reference environment variable

{{#env.API_KEY#}}

---
{{#env.API_KEY#}}

---

⚠️ 迭代节点规范(关键!)

⚠️ Iteration Node Specifications (Critical!)

迭代节点是 DSL 中最容易出错的部分,缺少任何一项都会导致导入失败!
Iteration nodes are the most error-prone part of DSL. Missing any item will cause import failure!

迭代节点完整结构

Complete Iteration Node Structure

yaml
undefined
yaml
undefined

1. iteration 节点 - 循环控制器

1. iteration node - Loop controller

  • id: '1741011600006' data: iterator_selector: ['1741011655068', 'text'] # 要遍历的数组 output_selector: ['1741011662463', 'result'] # 输出结果 output_type: array[object] # 必须格式 start_node_id: 1741011600006start # 必须指向 iteration-start title: 迭代处理 type: iteration position: {x: 200, y: 100}
  • id: '1741011600006' data: iterator_selector: ['1741011655068', 'text'] # Array to iterate over output_selector: ['1741011662463', 'result'] # Output results output_type: array[object] # Required format start_node_id: 1741011600006start # Must point to iteration-start title: Iteration Processing type: iteration position: {x: 200, y: 100}

2. iteration-start 节点 - 迭代入口(必须有!)

2. iteration-start node - Iteration entry (Mandatory!)

  • id: 1741011600006start data: title: 迭代开始 type: custom-iteration-start parentId: '1741011600006' # 必须指向父迭代节点 position: {x: 200, y: 200}
  • id: 1741011600006start data: title: Iteration Start type: custom-iteration-start parentId: '1741011600006' # Must point to parent iteration node position: {x: 200, y: 200}

3. 迭代内部节点 - 处理每个元素

3. Internal iteration node - Process each element

  • id: '1741011662463' data: isInIteration: true # 必须标记在迭代内 iteration_id: '1741011600006' # 必须标识所属迭代 parentId: '1741011600006' # 必须指向父迭代 title: 处理节点 type: llm position: {x: 200, y: 300}
  • id: '1741011662463' data: isInIteration: true # Must mark as in iteration iteration_id: '1741011600006' # Must identify the iteration it belongs to parentId: '1741011600006' # Must point to parent iteration title: Processing Node type: llm position: {x: 200, y: 300}

4. 迭代内部边 - 连接迭代内节点

4. Internal iteration edge - Connect nodes within iteration

  • source: 1741011600006start target: '1741011662463' type: isInIteration # 必须是 isInIteration zIndex: 1002 # 必须的渲染层级
undefined
  • source: 1741011600006start target: '1741011662463' type: isInIteration # Must be isInIteration zIndex: 1002 # Required rendering layer
undefined

成功版 vs 失败版对比

Success vs Failure Comparison

对比项✅ 成功版❌ 失败版
版本参考案例的版本版本不一致
iteration-start✅ 有❌ 缺少
parentId✅ 有❌ 缺少
iteration_id✅ 有❌ 缺少
isInIteration 边✅ 有❌ 缺少
zIndex: 1002✅ 有❌ 缺少
output_type 格式
array[object]
错误格式
start_node_id✅ 指向 iteration-start❌ 缺少
Comparison Item✅ Success Version❌ Failure Version
VersionSame as reference caseInconsistent version
iteration-start✅ Exists❌ Missing
parentId✅ Exists❌ Missing
iteration_id✅ Exists❌ Missing
isInIteration edge✅ Exists❌ Missing
zIndex: 1002✅ Exists❌ Missing
output_type format
array[object]
Incorrect format
start_node_id✅ Points to iteration-start❌ Missing

❌ 常见错误

❌ Common Errors

问题说明
缺少 iteration-start迭代必须有专门的 start 子节点,不是"内置"的
缺少 parentId迭代内部节点无法识别归属哪个迭代
缺少 iteration_id迭代无法正确管理内部节点
缺少 zIndex: 1002迭代内部边渲染层级错误
output_type 格式错误必须是
array[object]
IssueDescription
Missing iteration-startIteration must have a dedicated start sub-node, not "built-in"
Missing parentIdInternal iteration nodes cannot identify which iteration they belong to
Missing iteration_idIteration cannot manage internal nodes correctly
Missing zIndex: 1002Incorrect rendering layer for internal iteration edges
Incorrect output_type formatMust be
array[object]

迭代边连接类型

Iteration Edge Connection Types

类型说明是否用于迭代
custom
普通连接❌ 迭代外
true
条件为真
false
条件为假
isInIteration
迭代内连接✅ 必须用这个

TypeDescriptionUsed for Iteration?
custom
Normal connection❌ Outside iteration
true
Condition is true
false
Condition is false
isInIteration
Connection within iteration✅ Must use this

Edge 连接类型

Edge Connection Types

类型说明示例
custom
普通连接source → target
true
条件为真分支if-else → true
false
条件为假分支if-else → false
custom_case_id
自定义分支if-else → 自定义case_id
isInIteration
循环内连接iteration内节点连接

TypeDescriptionExample
custom
Normal connectionsource → target
true
Condition true branchif-else → true
false
Condition false branchif-else → false
custom_case_id
Custom branchif-else → custom_case_id
isInIteration
Connection within loopConnection between nodes in iteration

使用示例

Usage Example

示例:翻译工作流

Example: Translation Workflow

用户需求:
  • 名称:zh-en-translator
  • 功能:中译英翻译
  • 类型:workflow
  • 输入:中文文本
  • 流程:用户输入 → LLM翻译 → 返回结果
生成配置:
yaml
app:
  description: '中英文翻译工作流'
  icon: 🌐
  icon_background: '#E3F2FD'
  mode: workflow
  name: zh-en-translator
kind: app
version: {{参考案例的版本号}}
workflow:
  graph:
    edges:
    - source: '1741011655068'
      target: '1741011662463'
      type: custom
    - source: '1741011662463'
      target: llm
      type: custom
    - source: llm
      target: answer
      type: custom
    nodes:
    - data:
        title: 开始
        type: start
        variables:
        - variable: text
          type: paragraph
          label: 输入中文文本
          required: true
      id: '1741011655068'
      position: {x: 0, y: 263}
    - data:
        context:
          enabled: false
        model:
          provider: siliconflow
          name: internlm2_5-7b-chat
          mode: chat
        prompt_template:
        - role: system
          text: '请将以下中文翻译成英文,只输出翻译结果:{{#1741011655068.text#}}'
        title: LLM翻译
        type: llm
      id: llm
      position: {x: 382, y: 263}
    - data:
        answer: '{{#llm.text#}}'
        title: 翻译结果
        type: answer
      id: answer
      position: {x: 690, y: 263}

User Requirements:
  • Name: zh-en-translator
  • Function: Chinese to English translation
  • Type: workflow
  • Input: Chinese text
  • Process: User input → LLM translation → Return results
Generated Configuration:
yaml
app:
  description: 'Chinese-English Translation Workflow'
  icon: 🌐
  icon_background: '#E3F2FD'
  mode: workflow
  name: zh-en-translator
kind: app
version: {{version-number-of-reference-case}}
workflow:
  graph:
    edges:
    - source: '1741011655068'
      target: '1741011662463'
      type: custom
    - source: '1741011662463'
      target: llm
      type: custom
    - source: llm
      target: answer
      type: custom
    nodes:
    - data:
        title: Start
        type: start
        variables:
        - variable: text
          type: paragraph
          label: Input Chinese Text
          required: true
      id: '1741011655068'
      position: {x: 0, y: 263}
    - data:
        context:
          enabled: false
        model:
          provider: siliconflow
          name: internlm2_5-7b-chat
          mode: chat
        prompt_template:
        - role: system
          text: 'Please translate the following Chinese text into English, only output the translation result: {{#1741011655068.text#}}'
        title: LLM Translation
        type: llm
      id: llm
      position: {x: 382, y: 263}
    - data:
        answer: '{{#llm.text#}}'
        title: Translation Result
        type: answer
      id: answer
      position: {x: 690, y: 263}

最佳实践

Best Practices

1. 案例复用策略

1. Case Reuse Strategy

  1. 先定位:通过 INDEX.md 找到最相似的案例
  2. 再分析:阅读 DSL 文件,理解节点配置
  3. 后调整:基于参考模板进行个性化修改
  1. First Locate: Find the most similar case through INDEX.md
  2. Then Analyze: Read the DSL file to understand node configurations
  3. Finally Adjust: Make personalized modifications based on the reference template

2. 流程设计原则

2. Process Design Principles

  1. 从简单开始:先实现核心功能,再添加分支和循环
  2. 模块化设计:复杂流程拆分为可复用步骤
  3. 清晰命名:使用有意义的变量名
  1. Start Simple: Implement core functions first, then add branches and loops
  2. Modular Design: Split complex processes into reusable steps
  3. Clear Naming: Use meaningful variable names

3. DSL 编写检查清单

3. DSL Writing Checklist

  • 节点 ID 唯一且格式正确
  • 位置坐标合理,不重叠
  • Edge 连接正确,无断链
  • 变量引用格式正确
  • Model/Provider 配置有效
  • 输出变量名与引用一致
  • Node IDs are unique and formatted correctly
  • Position coordinates are reasonable and non-overlapping
  • Edge connections are correct, no broken links
  • Variable reference format is correct
  • Model/Provider configurations are valid
  • Output variable names are consistent with references

4. 测试验证建议

4. Testing and Verification Suggestions

  1. 生成后在 Dify 中导入测试
  2. 检查各节点的输入输出
  3. 验证条件分支逻辑
  4. 测试边界情况和错误处理

  1. Import and test in Dify after generation
  2. Check input and output of each node
  3. Verify conditional branch logic
  4. Test boundary cases and error handling

错误处理

Error Handling

错误类型处理方式
需求不完整提示用户补充缺失信息
流程逻辑错误指出可能的循环引用或断链
节点配置错误提供修正建议
变量引用无效列出可用的变量选项
案例定位失败扩大搜索范围或手动设计

Error TypeHandling Method
Incomplete RequirementsPrompt users to supplement missing information
Process Logic ErrorPoint out possible circular references or broken links
Node Configuration ErrorProvide correction suggestions
Invalid Variable ReferenceList available variable options
Case Location FailureExpand search scope or design manually

参考资源

Reference Resources

📂 案例目录结构

📂 Case Directory Structure

organized_dsl/
├── 01_内容生成与创作/
├── 02_图像生成与设计/
├── 03_视频生成/
├── 04_数据分析与可视化/
├── 05_文档处理与OCR/
├── 06_知识库与RAG/
├── 07_Agent与工具调用/
├── 08_教育与学习/
├── 09_商业与办公/
├── 10_多媒体处理/
├── 11_代码与开发/
├── 12_创意与娱乐/
├── 13_信息聚合/
├── 14_参考示例/
├── INDEX.md                    # 案例索引(搜索 organized_dsl/INDEX.md)
└── Dify_DSL_节点完整参考指南.md  # 节点配置参考(搜索 organized_dsl/Dify_DSL_节点完整参考指南.md)
organized_dsl/
├── 01_Content_Generation_Creation/
├── 02_Image_Generation_Design/
├── 03_Video_Generation/
├── 04_Data_Analysis_Visualization/
├── 05_Document_Processing_OCR/
├── 06_Knowledge_Base_RAG/
├── 07_Agent_Tool_Calling/
├── 08_Education_Learning/
├── 09_Business_Office/
├── 10_Multimedia_Processing/
├── 11_Code_Development/
├── 12_Creative_Entertainment/
├── 13_Information_Aggregation/
├── 14_Reference_Examples/
├── INDEX.md                    # Case index (search organized_dsl/INDEX.md)
└── Dify_DSL_Complete Node Reference Guide.md  # Node configuration reference (search organized_dsl/Dify_DSL_Complete Node Reference Guide.md)

📖 文档链接

📖 Document Links

  • INDEX.md:按功能分类的案例索引
  • Dify_DSL_节点完整参考指南.md:各节点的详细配置说明

  • INDEX.md: Case index classified by function
  • Dify_DSL_Complete Node Reference Guide.md: Detailed configuration instructions for each node

节点自动校验与生成规则

Node Automatic Validation and Generation Rules

版本号规则

Version Number Rules

yaml
undefined
yaml
undefined

✅ 正确 - 生成时必须使用

✅ Correct - Must use when generating

version: {{参考案例的版本号}}
version: {{version-number-of-reference-case}}

❌ 错误 - 禁止使用

❌ Incorrect - Prohibited

version: {{参考案例的版本号}}
undefined
version: {{version-number-of-reference-case}}
undefined

节点基础字段规则

Node Basic Field Rules

每个节点生成时必须包含:
yaml
- data:
    positionAbsolute: false      # ✅ 必须
    selected: false              # ✅ 必须
    title: "节点名称"
    type: "节点类型"
    # ... 其他字段
  height: 52
  id: '节点ID'
  position:
    x: 0
    y: 0
  width: 242
Each node must include the following when generated:
yaml
- data:
    positionAbsolute: false      # ✅ Mandatory
    selected: false              # ✅ Mandatory
    title: "Node Name"
    type: "Node Type"
    # ... Other fields
  height: 52
  id: 'node-id'
  position:
    x: 0
    y: 0
  width: 242

Edges 字段规则

Edges Field Rules

每条边生成时必须包含:
yaml
- data:
    isInIteration: false         # ✅ 必须
    selected: false              # ✅ 必须
    sourceType: "源节点类型"
    targetType: "目标节点类型"
  id: "边ID"
  source: "源节点ID"
  sourceHandle: "source"
  target: "目标节点ID"
  targetHandle: "target"
  type: "custom|true|false|isInIteration"
Each edge must include the following when generated:
yaml
- data:
    isInIteration: false         # ✅ Mandatory
    selected: false              # ✅ Mandatory
    sourceType: "Source Node Type"
    targetType: "Target Node Type"
  id: "edge-id"
  source: "source-node-id"
  sourceHandle: "source"
  target: "target-node-id"
  targetHandle: "target"
  type: "custom|true|false|isInIteration"

variable-aggregator 节点生成规则

variable-aggregator Node Generation Rules

yaml
undefined
yaml
undefined

✅ 正确写法 - 用于聚合多分支输出

✅ Correct Usage - For aggregating multi-branch outputs

  • data: output_type: string # 聚合结果的输出类型 type: variable-aggregator variables: # 聚合多分支的变量(二维数组)
      • '分支节点ID1' # 第一个分支的输出
      • text
      • '分支节点ID2' # 第二个分支的输出
      • text height: 211 id: '聚合节点ID'
  • data: output_type: string # Output type of aggregated results type: variable-aggregator variables: # Variables for aggregating multi-branches (2D array)
      • 'branch-node-id-1' # Output of first branch
      • text
      • 'branch-node-id-2' # Output of second branch
      • text height: 211 id: 'aggregator-node-id'

❌ 错误理解 - 不是简单的"将多个内容整合到一起"

❌ Misunderstanding - Not simply "integrate multiple contents together"

variable-aggregator 的真正用途:

Real purpose of variable-aggregator:

- 整合 IF/ELSE 条件分支的输出

- Integrate outputs of IF/ELSE conditional branches

- 整合并行结构的多个输出

- Integrate multiple outputs of parallel structures

- 确保无论哪个分支执行,下游都能通过统一变量引用

- Ensure that downstream can reference through unified variables regardless of which branch is executed

undefined
undefined

end 节点生成规则

end Node Generation Rules

yaml
undefined
yaml
undefined

✅ 正确写法 - Workflow 应用的结束节点

✅ Correct Usage - End node for Workflow applications

  • data: outputs:
    • value_selector:
      • '上游节点ID'
      • text variable: output type: end # ✅ 使用 type: end(仅用于 Workflow) height: 103 id: end
undefined
  • data: outputs:
    • value_selector:
      • 'upstream-node-id'
      • text variable: output type: end # ✅ Use type: end (only for Workflow) height: 103 id: end
undefined

answer 节点使用场景

answer Node Usage Scenarios

yaml
undefined
yaml
undefined

✅ 正确写法 - 仅用于 Chatflow 应用

✅ Correct Usage - Only for Chatflow applications

  • data: answer: '{{#llm.text#}}' # 使用 answer 字段 type: answer # ✅ 使用 type: answer(仅用于 Chatflow)

---
  • data: answer: '{{#llm.text#}}' # Use answer field type: answer # ✅ Use type: answer (only for Chatflow)

---

DSL 生成检查清单(生成后必查)

Post-Generation DSL Checklist (Mandatory After Generation)

生成 DSL 后,逐项检查:
应用类型检查:
  • Workflow 类型使用
    type: end
    ,Chatflow 类型使用
    type: answer
  • Workflow 只能有唯一 End 节点
  • Chatflow 支持多个 Answer 节点
节点检查:
  • 版本号与参考案例一致
  • 每个节点有
    data.positionAbsolute: false
  • 每个节点有
    data.selected: false
  • 每个节点有
    height
    width
边检查:
  • 每条边有
    data.sourceType
  • 每条边有
    data.targetType
  • 每条边有
    data.selected: false
  • 每条边有
    data.isInIteration
    (迭代外为 false)
variable-aggregator 检查:
  • 使用
    output_type
    (不是
    outputs
  • 使用
    variables
    数组格式(不是
    formatter_template
  • 理解用途:聚合多分支输出,不是简单整合内容
assigner vs variable-aggregator 检查:
  • 需要写入会话变量 → 使用
    assigner
  • 需要聚合多分支输出 → 使用
    variable-aggregator

最后更新: 2026-01-03 参考案例数: 125+
After generating the DSL, check item by item:
Application Type Check:
  • Workflow type uses
    type: end
    , Chatflow type uses
    type: answer
  • Workflow can only have one unique End node
  • Chatflow supports multiple Answer nodes
Node Check:
  • Version number is consistent with reference case
  • Each node has
    data.positionAbsolute: false
  • Each node has
    data.selected: false
  • Each node has
    height
    and
    width
Edge Check:
  • Each edge has
    data.sourceType
  • Each edge has
    data.targetType
  • Each edge has
    data.selected: false
  • Each edge has
    data.isInIteration
    (false outside iteration)
variable-aggregator Check:
  • Uses
    output_type
    (not
    outputs
    )
  • Uses
    variables
    array format (not
    formatter_template
    )
  • Understand the purpose: Aggregate multi-branch outputs, not simple content integration
assigner vs variable-aggregator Check:
  • Need to write to session variables → Use
    assigner
  • Need to aggregate multi-branch outputs → Use
    variable-aggregator

Last Updated: 2026-01-03 Number of Reference Cases: 125+