Dify0.15.3学习02_chatflow类型应用

一、背景信息介绍

搭建教程:https://jiangsanyin.github.io/2025/03/17/Ubuntu2204%E9%83%A8%E7%BD%B2Dify%E7%8E%AF%E5%A2%83/

现在一个新的服务器上重新搭建了一套dify0.15.3环境,服务器IP是:172.20.0.22,dify服务运行在81端口。

image-20250414100326346

二、工作流应用

2.1 chatflow类型应用

image-20250414171302837
image-20250414171423497
image-20250414105611601

创建如下工作流内容:

image-20250414171539734

具体内容如下:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
app:
description: ''
icon: 🤖
icon_background: '#FFEAD5'
mode: advanced-chat
name: 知识库问答工作流
use_icon_as_answer_icon: false
kind: app
version: 0.1.5
workflow:
conversation_variables: []
environment_variables: []
features:
file_upload:
allowed_file_extensions:
- .JPG
- .JPEG
- .PNG
- .GIF
- .WEBP
- .SVG
allowed_file_types:
- image
allowed_file_upload_methods:
- local_file
- remote_url
enabled: false
fileUploadConfig:
audio_file_size_limit: 50
batch_count_limit: 5
file_size_limit: 100
image_file_size_limit: 10
video_file_size_limit: 100
workflow_file_upload_limit: 10
image:
enabled: false
number_limits: 3
transfer_methods:
- local_file
- remote_url
number_limits: 3
opening_statement: 我是你 PyTorch学习助手,有什么可以帮您。
retriever_resource:
enabled: true
sensitive_word_avoidance:
enabled: false
speech_to_text:
enabled: false
suggested_questions: []
suggested_questions_after_answer:
enabled: false
text_to_speech:
enabled: false
language: ''
voice: ''
graph:
edges:
- data:
sourceType: start
targetType: llm
id: 1744599364444-llm
selected: false
source: '1744599364444'
sourceHandle: source
target: llm
targetHandle: target
type: custom
- data:
isInIteration: false
sourceType: llm
targetType: knowledge-retrieval
id: llm-source-1744604782998-target
selected: false
source: llm
sourceHandle: source
target: '1744604782998'
targetHandle: target
type: custom
zIndex: 0
- data:
isInIteration: false
sourceType: knowledge-retrieval
targetType: llm
id: 1744604782998-source-1744605230519-target
selected: false
source: '1744604782998'
sourceHandle: source
target: '1744605230519'
targetHandle: target
type: custom
zIndex: 0
- data:
isInIteration: false
sourceType: llm
targetType: answer
id: 1744605230519-source-answer-target
selected: false
source: '1744605230519'
sourceHandle: source
target: answer
targetHandle: target
type: custom
zIndex: 0
nodes:
- data:
desc: ''
selected: false
title: 开始
type: start
variables: []
height: 53
id: '1744599364444'
position:
x: 80
y: 282
positionAbsolute:
x: 80
y: 282
selected: true
sourcePosition: right
targetPosition: left
type: custom
width: 244
- data:
context:
enabled: false
variable_selector: []
desc: ''
memory:
query_prompt_template: '用户的问题如下:

{{#sys.query#}}'
role_prefix:
assistant: ''
user: ''
window:
enabled: true
size: 10
model:
completion_params:
temperature: 0.7
mode: chat
name: qwen-max-latest
provider: tongyi
prompt_template:
- id: 90d3eb3d-8c11-4069-9f6c-b0cf1effd52b
role: system
text: '## 任务

请从用户给定的问题中提取关键内容,用于检索知识库内容

## 输出

输出多个关键字或关键句,关键字或关键句之间用空格隔开,不需要其他无关的文本内容。禁止直接回复用户的问题'
selected: false
title: 提取关键内容
type: llm
variables: []
vision:
enabled: false
height: 97
id: llm
position:
x: 380
y: 282
positionAbsolute:
x: 380
y: 282
selected: false
sourcePosition: right
targetPosition: left
type: custom
width: 244
- data:
answer: '{{#1744605230519.text#}}'
desc: ''
selected: false
title: 直接回复
type: answer
variables: []
height: 102
id: answer
position:
x: 1273
y: 282
positionAbsolute:
x: 1273
y: 282
selected: false
sourcePosition: right
targetPosition: left
type: custom
width: 244
- data:
dataset_ids:
- 12b20101-0ff8-422b-98fc-cc78440007d8
desc: ''
multiple_retrieval_config:
reranking_enable: true
reranking_mode: reranking_model
reranking_model:
model: gte-rerank
provider: tongyi
top_k: 4
query_variable_selector:
- llm
- text
retrieval_mode: multiple
selected: false
title: 知识检索
type: knowledge-retrieval
height: 91
id: '1744604782998'
position:
x: 681
y: 282
positionAbsolute:
x: 681
y: 282
selected: false
sourcePosition: right
targetPosition: left
type: custom
width: 244
- data:
context:
enabled: true
variable_selector:
- '1744604782998'
- result
desc: ''
memory:
query_prompt_template: ''
role_prefix:
assistant: ''
user: ''
window:
enabled: false
size: 50
model:
completion_params:
temperature: 0.7
mode: chat
name: qwen-max-latest
provider: tongyi
prompt_template:
- id: 0741400e-f6df-4965-aa25-27a88c6423ac
role: system
text: '## 角色

你是一个专业的客服,擅长根据知识库内容回答用户的问题

## 背景

严格根据知识库内容回答用户问题,对于用户理解私有文档十分重要。

## 任务

严格根据下面的知识库的内容回答用户的问题

## 知识库

{{#context#}}'
selected: false
title: 回答问题
type: llm
variables: []
vision:
enabled: false
height: 97
id: '1744605230519'
position:
x: 959
y: 271
positionAbsolute:
x: 959
y: 271
selected: false
sourcePosition: right
targetPosition: left
type: custom
width: 244
viewport:
x: 6.0819642019071125
y: -54.89333757760929
zoom: 0.870550563296124

执行效果如下:

image-20250414172009151

Dify0.15.3学习02_chatflow类型应用
https://jiangsanyin.github.io/2025/04/14/Dify0.15.3学习02_chatflow类型应用/
作者
sanyinjiang
发布于
2025年4月14日
许可协议