把 Dify 里这几个核心模块讲清楚,快速理解它们的区别和适用场景👇
下面是 Dify 五大核心模块的关系总览,从简单到复杂,帮你快速建立整体认知:
#mermaid-svg-7agzZjwN375cDhyd{font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:16px;fill:#333;}@keyframes edge-animation-frame{from{stroke-dashoffset:0;}}@keyframes dash{to{stroke-dashoffset:0;}}#mermaid-svg-7agzZjwN375cDhyd .edge-animation-slow{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 50s linear infinite;stroke-linecap:round;}#mermaid-svg-7agzZjwN375cDhyd .edge-animation-fast{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 20s linear infinite;stroke-linecap:round;}#mermaid-svg-7agzZjwN375cDhyd .error-icon{fill:#552222;}#mermaid-svg-7agzZjwN375cDhyd .error-text{fill:#552222;stroke:#552222;}#mermaid-svg-7agzZjwN375cDhyd .edge-thickness-normal{stroke-width:1px;}#mermaid-svg-7agzZjwN375cDhyd .edge-thickness-thick{stroke-width:3.5px;}#mermaid-svg-7agzZjwN375cDhyd .edge-pattern-solid{stroke-dasharray:0;}#mermaid-svg-7agzZjwN375cDhyd .edge-thickness-invisible{stroke-width:0;fill:none;}#mermaid-svg-7agzZjwN375cDhyd .edge-pattern-dashed{stroke-dasharray:3;}#mermaid-svg-7agzZjwN375cDhyd .edge-pattern-dotted{stroke-dasharray:2;}#mermaid-svg-7agzZjwN375cDhyd .marker{fill:#333333;stroke:#333333;}#mermaid-svg-7agzZjwN375cDhyd .marker.cross{stroke:#333333;}#mermaid-svg-7agzZjwN375cDhyd svg{font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:16px;}#mermaid-svg-7agzZjwN375cDhyd p{margin:0;}#mermaid-svg-7agzZjwN375cDhyd .label{font-family:"trebuchet ms",verdana,arial,sans-serif;color:#333;}#mermaid-svg-7agzZjwN375cDhyd .cluster-label text{fill:#333;}#mermaid-svg-7agzZjwN375cDhyd .cluster-label span{color:#333;}#mermaid-svg-7agzZjwN375cDhyd .cluster-label span p{background-color:transparent;}#mermaid-svg-7agzZjwN375cDhyd .label text,#mermaid-svg-7agzZjwN375cDhyd span{fill:#333;color:#333;}#mermaid-svg-7agzZjwN375cDhyd .node rect,#mermaid-svg-7agzZjwN375cDhyd .node circle,#mermaid-svg-7agzZjwN375cDhyd .node ellipse,#mermaid-svg-7agzZjwN375cDhyd .node polygon,#mermaid-svg-7agzZjwN375cDhyd .node path{fill:#ECECFF;stroke:#9370DB;stroke-width:1px;}#mermaid-svg-7agzZjwN375cDhyd .rough-node .label text,#mermaid-svg-7agzZjwN375cDhyd .node .label text,#mermaid-svg-7agzZjwN375cDhyd .image-shape .label,#mermaid-svg-7agzZjwN375cDhyd .icon-shape .label{text-anchor:middle;}#mermaid-svg-7agzZjwN375cDhyd .node .katex path{fill:#000;stroke:#000;stroke-width:1px;}#mermaid-svg-7agzZjwN375cDhyd .rough-node .label,#mermaid-svg-7agzZjwN375cDhyd .node .label,#mermaid-svg-7agzZjwN375cDhyd .image-shape .label,#mermaid-svg-7agzZjwN375cDhyd .icon-shape .label{text-align:center;}#mermaid-svg-7agzZjwN375cDhyd .node.clickable{cursor:pointer;}#mermaid-svg-7agzZjwN375cDhyd .root .anchor path{fill:#333333!important;stroke-width:0;stroke:#333333;}#mermaid-svg-7agzZjwN375cDhyd .arrowheadPath{fill:#333333;}#mermaid-svg-7agzZjwN375cDhyd .edgePath .path{stroke:#333333;stroke-width:2.0px;}#mermaid-svg-7agzZjwN375cDhyd .flowchart-link{stroke:#333333;fill:none;}#mermaid-svg-7agzZjwN375cDhyd .edgeLabel{background-color:rgba(232,232,232, 0.8);text-align:center;}#mermaid-svg-7agzZjwN375cDhyd .edgeLabel p{background-color:rgba(232,232,232, 0.8);}#mermaid-svg-7agzZjwN375cDhyd .edgeLabel rect{opacity:0.5;background-color:rgba(232,232,232, 0.8);fill:rgba(232,232,232, 0.8);}#mermaid-svg-7agzZjwN375cDhyd .labelBkg{background-color:rgba(232, 232, 232, 0.5);}#mermaid-svg-7agzZjwN375cDhyd .cluster rect{fill:#ffffde;stroke:#aaaa33;stroke-width:1px;}#mermaid-svg-7agzZjwN375cDhyd .cluster text{fill:#333;}#mermaid-svg-7agzZjwN375cDhyd .cluster span{color:#333;}#mermaid-svg-7agzZjwN375cDhyd div.mermaidTooltip{position:absolute;text-align:center;max-width:200px;padding:2px;font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:12px;background:hsl(80, 100%, 96.2745098039%);border:1px solid #aaaa33;border-radius:2px;pointer-events:none;z-index:100;}#mermaid-svg-7agzZjwN375cDhyd .flowchartTitleText{text-anchor:middle;font-size:18px;fill:#333;}#mermaid-svg-7agzZjwN375cDhyd rect.text{fill:none;stroke-width:0;}#mermaid-svg-7agzZjwN375cDhyd .icon-shape,#mermaid-svg-7agzZjwN375cDhyd .image-shape{background-color:rgba(232,232,232, 0.8);text-align:center;}#mermaid-svg-7agzZjwN375cDhyd .icon-shape p,#mermaid-svg-7agzZjwN375cDhyd .image-shape p{background-color:rgba(232,232,232, 0.8);padding:2px;}#mermaid-svg-7agzZjwN375cDhyd .icon-shape .label rect,#mermaid-svg-7agzZjwN375cDhyd .image-shape .label rect{opacity:0.5;background-color:rgba(232,232,232, 0.8);fill:rgba(232,232,232, 0.8);}#mermaid-svg-7agzZjwN375cDhyd .label-icon{display:inline-block;height:1em;overflow:visible;vertical-align:-0.125em;}#mermaid-svg-7agzZjwN375cDhyd .node .label-icon path{fill:currentColor;stroke:revert;stroke-width:revert;}#mermaid-svg-7agzZjwN375cDhyd :root{--mermaid-font-family:"trebuchet ms",verdana,arial,sans-serif;} 文本生成
单轮内容生产
聊天助手
基础多轮对话
Chatflow
对话式可视化流程
工作流
后端自动化流程
Agent
自主规划+工具调用
1. 文本生成(Text Generation)
定位:单轮内容生产工具
- 特点:一问一答、无多轮对话记忆,适合一次性生成任务。
- 典型场景:文案生成、摘要提取、翻译、单轮内容创作。
- 优势:配置极简,只需要写好提示词,直接调用模型生成结果。
- 局限:不支持对话记忆、无法处理复杂多步逻辑。
2. 聊天助手(Chat Assistant / Chatbot)
定位:基础多轮对话机器人
- 特点:最轻量化的对话应用,自带对话记忆,支持接入知识库做RAG。
- 典型场景:客服问答、简单知识问答机器人、日常聊天助手。
- 优势:零代码快速搭建,一键配置提示词+知识库就能上线。
- 局限:逻辑能力弱,不支持复杂分支、多节点流程控制。
3. Chatflow(对话式工作流)
定位:可视化编排的对话类应用
- 特点:把多轮对话拆解成节点+分支流程,支持条件判断、变量传递、工具调用,全程面向对话交互。
- 典型场景:带多步逻辑的客服机器人、对话式审批/填表、引导式问答助手。
- 优势:可视化拖拽编排,能处理复杂对话分支,同时保留对话记忆。
- 局限:流程强绑定对话上下文,不适合无交互的批量任务。
4. 工作流(Workflow)
定位:后端自动化任务引擎
- 特点:面向非对话场景的流程编排,无对话记忆,专注自动化、批处理任务。
- 典型场景:批量数据处理、定时任务、自动化报表、后端数据清洗/转换(比如你之前的数组转字符串需求)。
- 优势:纯后端执行,不依赖用户持续交互,支持循环、并行节点,可被API调用。
- 局限:不适合需要和用户实时对话交互的场景。
5. Agent(智能体)
定位:自主任务执行者
- 特点:具备自主规划、工具调用、复杂推理能力,通过大模型动态决策下一步动作,而不是按固定流程执行。
- 典型场景:复杂任务拆解(比如订机票+查天气+写行程)、多工具协同的通用助手、需要动态决策的复杂问题处理。
- 优势:无需预设固定流程,模型会根据用户目标自主规划步骤、调用工具。
- 局限:可控性弱于固定流程,成本更高,容易出现不可预期的执行路径。
对比速查表
| 模块 | 核心特点 | 对话记忆 | 流程控制 | 适用场景 |
|---|---|---|---|---|
| 文本生成 | 单轮内容生成 | ❌ | ❌ | 一次性文案、翻译、摘要 |
| 聊天助手 | 基础多轮对话 | ✅ | ❌ | 简单问答、知识库客服 |
| Chatflow | 对话式可视化流程 | ✅ | ✅ | 带分支逻辑的对话机器人 |
| 工作流 | 后端自动化流程 | ❌ | ✅ | 批处理、数据转换、定时任务 |
| Agent | 自主规划+工具调用 | ✅ | 模型动态决策 | 复杂多工具协同任务 |
💡
下面这张选型决策流程图,可以帮助你根据实际需求快速定位应该使用哪个模块:
#mermaid-svg-N4v5RWK2yyED27Vs{font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:16px;fill:#333;}@keyframes edge-animation-frame{from{stroke-dashoffset:0;}}@keyframes dash{to{stroke-dashoffset:0;}}#mermaid-svg-N4v5RWK2yyED27Vs .edge-animation-slow{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 50s linear infinite;stroke-linecap:round;}#mermaid-svg-N4v5RWK2yyED27Vs .edge-animation-fast{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 20s linear infinite;stroke-linecap:round;}#mermaid-svg-N4v5RWK2yyED27Vs .error-icon{fill:#552222;}#mermaid-svg-N4v5RWK2yyED27Vs .error-text{fill:#552222;stroke:#552222;}#mermaid-svg-N4v5RWK2yyED27Vs .edge-thickness-normal{stroke-width:1px;}#mermaid-svg-N4v5RWK2yyED27Vs .edge-thickness-thick{stroke-width:3.5px;}#mermaid-svg-N4v5RWK2yyED27Vs .edge-pattern-solid{stroke-dasharray:0;}#mermaid-svg-N4v5RWK2yyED27Vs .edge-thickness-invisible{stroke-width:0;fill:none;}#mermaid-svg-N4v5RWK2yyED27Vs .edge-pattern-dashed{stroke-dasharray:3;}#mermaid-svg-N4v5RWK2yyED27Vs .edge-pattern-dotted{stroke-dasharray:2;}#mermaid-svg-N4v5RWK2yyED27Vs .marker{fill:#333333;stroke:#333333;}#mermaid-svg-N4v5RWK2yyED27Vs .marker.cross{stroke:#333333;}#mermaid-svg-N4v5RWK2yyED27Vs svg{font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:16px;}#mermaid-svg-N4v5RWK2yyED27Vs p{margin:0;}#mermaid-svg-N4v5RWK2yyED27Vs .label{font-family:"trebuchet ms",verdana,arial,sans-serif;color:#333;}#mermaid-svg-N4v5RWK2yyED27Vs .cluster-label text{fill:#333;}#mermaid-svg-N4v5RWK2yyED27Vs .cluster-label span{color:#333;}#mermaid-svg-N4v5RWK2yyED27Vs .cluster-label span p{background-color:transparent;}#mermaid-svg-N4v5RWK2yyED27Vs .label text,#mermaid-svg-N4v5RWK2yyED27Vs span{fill:#333;color:#333;}#mermaid-svg-N4v5RWK2yyED27Vs .node rect,#mermaid-svg-N4v5RWK2yyED27Vs .node circle,#mermaid-svg-N4v5RWK2yyED27Vs .node ellipse,#mermaid-svg-N4v5RWK2yyED27Vs .node polygon,#mermaid-svg-N4v5RWK2yyED27Vs .node path{fill:#ECECFF;stroke:#9370DB;stroke-width:1px;}#mermaid-svg-N4v5RWK2yyED27Vs .rough-node .label text,#mermaid-svg-N4v5RWK2yyED27Vs .node .label text,#mermaid-svg-N4v5RWK2yyED27Vs .image-shape .label,#mermaid-svg-N4v5RWK2yyED27Vs .icon-shape .label{text-anchor:middle;}#mermaid-svg-N4v5RWK2yyED27Vs .node .katex path{fill:#000;stroke:#000;stroke-width:1px;}#mermaid-svg-N4v5RWK2yyED27Vs .rough-node .label,#mermaid-svg-N4v5RWK2yyED27Vs .node .label,#mermaid-svg-N4v5RWK2yyED27Vs .image-shape .label,#mermaid-svg-N4v5RWK2yyED27Vs .icon-shape .label{text-align:center;}#mermaid-svg-N4v5RWK2yyED27Vs .node.clickable{cursor:pointer;}#mermaid-svg-N4v5RWK2yyED27Vs .root .anchor path{fill:#333333!important;stroke-width:0;stroke:#333333;}#mermaid-svg-N4v5RWK2yyED27Vs .arrowheadPath{fill:#333333;}#mermaid-svg-N4v5RWK2yyED27Vs .edgePath .path{stroke:#333333;stroke-width:2.0px;}#mermaid-svg-N4v5RWK2yyED27Vs .flowchart-link{stroke:#333333;fill:none;}#mermaid-svg-N4v5RWK2yyED27Vs .edgeLabel{background-color:rgba(232,232,232, 0.8);text-align:center;}#mermaid-svg-N4v5RWK2yyED27Vs .edgeLabel p{background-color:rgba(232,232,232, 0.8);}#mermaid-svg-N4v5RWK2yyED27Vs .edgeLabel rect{opacity:0.5;background-color:rgba(232,232,232, 0.8);fill:rgba(232,232,232, 0.8);}#mermaid-svg-N4v5RWK2yyED27Vs .labelBkg{background-color:rgba(232, 232, 232, 0.5);}#mermaid-svg-N4v5RWK2yyED27Vs .cluster rect{fill:#ffffde;stroke:#aaaa33;stroke-width:1px;}#mermaid-svg-N4v5RWK2yyED27Vs .cluster text{fill:#333;}#mermaid-svg-N4v5RWK2yyED27Vs .cluster span{color:#333;}#mermaid-svg-N4v5RWK2yyED27Vs div.mermaidTooltip{position:absolute;text-align:center;max-width:200px;padding:2px;font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:12px;background:hsl(80, 100%, 96.2745098039%);border:1px solid #aaaa33;border-radius:2px;pointer-events:none;z-index:100;}#mermaid-svg-N4v5RWK2yyED27Vs .flowchartTitleText{text-anchor:middle;font-size:18px;fill:#333;}#mermaid-svg-N4v5RWK2yyED27Vs rect.text{fill:none;stroke-width:0;}#mermaid-svg-N4v5RWK2yyED27Vs .icon-shape,#mermaid-svg-N4v5RWK2yyED27Vs .image-shape{background-color:rgba(232,232,232, 0.8);text-align:center;}#mermaid-svg-N4v5RWK2yyED27Vs .icon-shape p,#mermaid-svg-N4v5RWK2yyED27Vs .image-shape p{background-color:rgba(232,232,232, 0.8);padding:2px;}#mermaid-svg-N4v5RWK2yyED27Vs .icon-shape .label rect,#mermaid-svg-N4v5RWK2yyED27Vs .image-shape .label rect{opacity:0.5;background-color:rgba(232,232,232, 0.8);fill:rgba(232,232,232, 0.8);}#mermaid-svg-N4v5RWK2yyED27Vs .label-icon{display:inline-block;height:1em;overflow:visible;vertical-align:-0.125em;}#mermaid-svg-N4v5RWK2yyED27Vs .node .label-icon path{fill:currentColor;stroke:revert;stroke-width:revert;}#mermaid-svg-N4v5RWK2yyED27Vs :root{--mermaid-font-family:"trebuchet ms",verdana,arial,sans-serif;} 否
是
否
是
否
是
否
是
你的需求是什么?
需要多轮
对话记忆吗?
需要流程控制
或分支逻辑吗?
需要复杂流程
编排吗?
文本生成
Text Generation
工作流
Workflow
聊天助手
Chat Assistant
需要模型自主
决策调用工具吗?
Chatflow
对话式工作流
Agent
智能体