将斗鱼日报Dify工作流改为按任务类型分支

1. 在斗鱼日报 Dify 工作流中新增 if-else 节点,按 daily_report、danmu_summary、fans_daily_report 做真实业务分支。\n2. 为运营日报、弹幕总结、粉丝日报分别拆分主 LLM 与回退 LLM,减少不同文风互相污染。\n3. 更新斗鱼 Dify 接入文档,改为分支版工作流说明,明确当前推荐结构与验证方式。
This commit is contained in:
liuwei
2026-04-27 12:34:06 +08:00
parent 0bb409ab49
commit ea2c01532e
2 changed files with 795 additions and 228 deletions

View File

@@ -67,11 +67,58 @@ workflow:
isInIteration: false
isInLoop: false
sourceType: start
targetType: llm
id: 200000001-source-200000002-target
targetType: if-else
id: 200000001-source-200000010-target
source: '200000001'
sourceHandle: source
target: '200000002'
target: '200000010'
targetHandle: target
type: custom
zIndex: 0
- data:
isInIteration: false
isInLoop: false
sourceType: if-else
targetType: llm
id: 200000010-daily-report-case-200000101-target
source: '200000010'
sourceHandle: daily_report_case
target: '200000101'
targetHandle: target
type: custom
zIndex: 0
- data:
isInIteration: false
isInLoop: false
sourceType: if-else
targetType: llm
id: 200000010-danmu-summary-case-200000102-target
source: '200000010'
sourceHandle: danmu_summary_case
target: '200000102'
targetHandle: target
type: custom
zIndex: 0
- data:
isInIteration: false
isInLoop: false
sourceType: if-else
targetType: llm
id: 200000010-fans-daily-report-case-200000103-target
source: '200000010'
sourceHandle: fans_daily_report_case
target: '200000103'
targetHandle: target
type: custom
zIndex: 0
- data:
isInLoop: false
sourceType: if-else
targetType: llm
id: 200000010-false-200000101-target
source: '200000010'
sourceHandle: 'false'
target: '200000101'
targetHandle: target
type: custom
zIndex: 0
@@ -80,10 +127,34 @@ workflow:
isInLoop: false
sourceType: llm
targetType: end
id: 200000002-source-200000003-target
source: '200000002'
id: 200000101-source-200000301-target
source: '200000101'
sourceHandle: source
target: '200000003'
target: '200000301'
targetHandle: target
type: custom
zIndex: 0
- data:
isInIteration: false
isInLoop: false
sourceType: llm
targetType: end
id: 200000102-source-200000302-target
source: '200000102'
sourceHandle: source
target: '200000302'
targetHandle: target
type: custom
zIndex: 0
- data:
isInIteration: false
isInLoop: false
sourceType: llm
targetType: end
id: 200000103-source-200000303-target
source: '200000103'
sourceHandle: source
target: '200000303'
targetHandle: target
type: custom
zIndex: 0
@@ -91,10 +162,32 @@ workflow:
isInLoop: false
sourceType: llm
targetType: llm
id: 200000002-fail-branch-17766504655450-target
source: '200000002'
id: 200000101-fail-branch-200000201-target
source: '200000101'
sourceHandle: fail-branch
target: '17766504655450'
target: '200000201'
targetHandle: target
type: custom
zIndex: 0
- data:
isInLoop: false
sourceType: llm
targetType: llm
id: 200000102-fail-branch-200000202-target
source: '200000102'
sourceHandle: fail-branch
target: '200000202'
targetHandle: target
type: custom
zIndex: 0
- data:
isInLoop: false
sourceType: llm
targetType: llm
id: 200000103-fail-branch-200000203-target
source: '200000103'
sourceHandle: fail-branch
target: '200000203'
targetHandle: target
type: custom
zIndex: 0
@@ -103,10 +196,34 @@ workflow:
isInLoop: false
sourceType: llm
targetType: end
id: 17766504655450-source-1776650579720-target
source: '17766504655450'
id: 200000201-source-200000304-target
source: '200000201'
sourceHandle: source
target: '1776650579720'
target: '200000304'
targetHandle: target
type: custom
zIndex: 0
- data:
isInIteration: false
isInLoop: false
sourceType: llm
targetType: end
id: 200000202-source-200000305-target
source: '200000202'
sourceHandle: source
target: '200000305'
targetHandle: target
type: custom
zIndex: 0
- data:
isInIteration: false
isInLoop: false
sourceType: llm
targetType: end
id: 200000203-source-200000306-target
source: '200000203'
sourceHandle: source
target: '200000306'
targetHandle: target
type: custom
zIndex: 0
@@ -125,10 +242,10 @@ workflow:
required: true
type: paragraph
variable: query
# task_type 是项目侧与 Dify 工作流之间的核心路由字段
# task_type 是整个工作流的业务路由开关
# 1. daily_report运营版完整日报正文
# 2. danmu_summary运营版图片上半部分弹幕总结;
# 3. fans_daily_report单独给粉丝看的欢乐恶搞日报。
# 2. danmu_summary运营版图片上半部分弹幕总结
# 3. fans_daily_report粉丝向欢乐恶搞日报。
- default: daily_report
hint: daily_report / danmu_summary / fans_daily_report
label: task_type
@@ -205,10 +322,61 @@ workflow:
id: '200000001'
position:
x: 0
y: 0
y: 120
positionAbsolute:
x: 0
y: 0
y: 120
selected: false
sourcePosition: right
targetPosition: left
type: custom
width: 242
- data:
cases:
- case_id: danmu_summary_case
conditions:
- comparison_operator: contains
id: danmu_summary_case_cond
value: danmu_summary
varType: string
variable_selector:
- '200000001'
- task_type
id: danmu_summary_case
logical_operator: and
- case_id: fans_daily_report_case
conditions:
- comparison_operator: contains
id: fans_daily_report_case_cond
value: fans_daily_report
varType: string
variable_selector:
- '200000001'
- task_type
id: fans_daily_report_case
logical_operator: and
- case_id: daily_report_case
conditions:
- comparison_operator: contains
id: daily_report_case_cond
value: daily_report
varType: string
variable_selector:
- '200000001'
- task_type
id: daily_report_case
logical_operator: and
selected: false
title: task_type 分支
type: if-else
height: 196
id: '200000010'
position:
x: 320
y: 145
positionAbsolute:
x: 320
y: 145
selected: false
sourcePosition: right
targetPosition: left
@@ -218,53 +386,44 @@ workflow:
context:
enabled: false
variable_selector: []
# 运营版正文分支:
# 1. prompt 只服务 daily_report不再夹带粉丝版/弹幕总结的额外风格说明;
# 2. 让模型专注输出主线、运营观察、热点时段和高频梗,减少串味。
error_strategy: fail-branch
model:
completion_params:
temperature: 0.3
temperature: 0.25
mode: chat
name: grok-4
provider: langgenius/openai_api_compatible/openai_api_compatible
prompt_template:
- id: 00000000-0000-0000-0000-000000000001
- id: daily_system_1
role: system
text: '你是「斗鱼直播日报助手」。
text: '你是「斗鱼直播运营日报助手」。
会收到 task_type、提示词和结构化弹幕材料
的唯一任务是生成运营版完整日报正文
输出原则:
输出总原则:
1. 只依据输入材料生成,不编造。
1. 只根据给定材料生成内容,不编造
2. 输出中文纯文本,不要使用代码块
2. 使用中文自然表达,不要输出代码块
3. 聚焦直播主线、弹幕关注点、运营观察、热点时段和高频梗
3. 输出纯文本,不要添加额外前后缀说明
4. 如果 system_prompt 非空,优先遵循其中的格式要求
4. 严格遵守长度约束:不超过 max_length。
任务路由规则:
- 当 task_type=danmu_summary输出“弹幕总结”风格偏现场氛围、观众情绪与高频梗不写运营策略。
- 当 task_type=daily_report输出“完整日报正文”风格包含主线、运营观察、热点时段、高频梗等。
- 当 task_type=fans_daily_report输出“粉丝向乐子日报”风格整体要开心、欢乐、带一点整活气质
更像群友复盘直播间名场面;不要写运营分析,不要出现策略、转化、建议等运营词。
若 system_prompt 非空,优先遵循其格式和结构要求。
5. 严格控制在 max_length 以内
'
- id: 00000000-0000-0000-0000-000000000002
- id: daily_user_1
role: user
text: '【task_type
text: '【任务类型
{{#200000001.task_type#}}
daily_report
【长度限制 max_length
【长度限制】
{{#200000001.max_length#}}
@@ -279,9 +438,98 @@ workflow:
{{#200000001.user_prompt#}}
query兼容字段
meta
{{#200000001.query#}}
room_id={{#200000001.room_id#}}, anchor_day={{#200000001.anchor_day#}},
nickname={{#200000001.nickname#}}
【report_payload_json】
{{#200000001.report_payload_json#}}
请直接输出运营版完整日报正文。
'
retry_config:
max_retries: 2
retry_enabled: true
retry_interval: 1000
selected: false
title: 运营日报 LLM
type: llm
vision:
enabled: false
height: 154
id: '200000101'
position:
x: 664
y: 0
positionAbsolute:
x: 664
y: 0
selected: false
sourcePosition: right
targetPosition: left
type: custom
width: 242
- data:
context:
enabled: false
variable_selector: []
# 弹幕总结分支:
# 1. 单独约束为“图片上半部分摘要”;
# 2. 强制强调现场感、情绪和梗,避免长成完整日报。
error_strategy: fail-branch
model:
completion_params:
temperature: 0.2
mode: chat
name: grok-4
provider: langgenius/openai_api_compatible/openai_api_compatible
prompt_template:
- id: danmu_system_1
role: system
text: '你是「斗鱼直播弹幕总结助手」。
你的唯一任务是生成日报图片上半部分的弹幕总结。
输出原则:
1. 只根据输入材料生成,不编造。
2. 输出中文纯文本,不要使用代码块。
3. 聚焦现场氛围、观众情绪、高频梗、节奏变化和弹幕原话感。
4. 不要写运营策略、建议、转化或复盘结论。
5. 如果 system_prompt 非空,优先遵循其中的格式要求。
6. 严格控制在 max_length 以内。
'
- id: danmu_user_1
role: user
text: '【任务类型】
danmu_summary
【长度限制】
{{#200000001.max_length#}}
【system_prompt】
{{#200000001.system_prompt#}}
【user_prompt】
{{#200000001.user_prompt#}}
【meta】
@@ -295,52 +543,26 @@ workflow:
{{#200000001.report_payload_json#}}
按上述信息直接产出最终结果。
如果 task_type=fans_daily_report请优先保留“现场弹幕感”和“群友整活感”
让输出明显区别于运营版日报。
直接输出弹幕总结结果。
'
retry_config:
max_retries: 3
max_retries: 2
retry_enabled: true
retry_interval: 1000
selected: true
title: LLM
selected: false
title: 弹幕总结 LLM
type: llm
vision:
enabled: false
height: 154
id: '200000002'
id: '200000102'
position:
x: 342
y: 82
x: 664
y: 210
positionAbsolute:
x: 342
y: 82
selected: true
sourcePosition: right
targetPosition: left
type: custom
width: 242
- data:
outputs:
- value_selector:
- '200000002'
- text
value_type: string
variable: text
selected: false
title: 输出
type: end
height: 88
id: '200000003'
position:
x: 704
y: 89
positionAbsolute:
x: 704
y: 89
x: 664
y: 210
selected: false
sourcePosition: right
targetPosition: left
@@ -350,6 +572,253 @@ workflow:
context:
enabled: false
variable_selector: []
# 粉丝乐子日报分支:
# 1. 只服务 fans_daily_report
# 2. 让模型专注输出开心、欢乐、整活的粉丝向内容;
# 3. 显式禁止混入运营分析,降低“风格串台”概率。
error_strategy: fail-branch
model:
completion_params:
temperature: 0.35
mode: chat
name: grok-4
provider: langgenius/openai_api_compatible/openai_api_compatible
prompt_template:
- id: fans_system_1
role: system
text: '你是「斗鱼直播粉丝乐子日报助手」。
你的唯一任务是生成单独给粉丝看的欢乐恶搞日报。
输出原则:
1. 只依据输入材料生成,不编造。
2. 输出中文纯文本,不要使用代码块。
3. 语气可以开心、欢乐、轻微夸张,像群友复盘名场面。
4. 不要写运营分析,不要出现策略、建议、转化、数据表现等运营词。
5. 尽量保留现场弹幕感、口头语和接梗氛围。
6. 如果 system_prompt 非空,优先遵循其中的格式要求。
7. 严格控制在 max_length 以内。
'
- id: fans_user_1
role: user
text: '【任务类型】
fans_daily_report
【长度限制】
{{#200000001.max_length#}}
【system_prompt】
{{#200000001.system_prompt#}}
【user_prompt】
{{#200000001.user_prompt#}}
【meta】
room_id={{#200000001.room_id#}}, anchor_day={{#200000001.anchor_day#}},
nickname={{#200000001.nickname#}}
【report_payload_json】
{{#200000001.report_payload_json#}}
请直接输出粉丝向乐子日报。
'
retry_config:
max_retries: 2
retry_enabled: true
retry_interval: 1000
selected: true
title: 粉丝日报 LLM
type: llm
vision:
enabled: false
height: 172
id: '200000103'
position:
x: 664
y: 440
positionAbsolute:
x: 664
y: 440
selected: true
sourcePosition: right
targetPosition: left
type: custom
width: 242
- data:
context:
enabled: false
variable_selector: []
# 运营日报回退模型:
# 主模型失败时仍然只处理运营版正文,避免错误回退时跑到别的文风。
model:
completion_params:
temperature: 0.2
mode: chat
name: gpt-5.4
provider: langgenius/openai_api_compatible/openai_api_compatible
prompt_template:
- id: daily_system_2
role: system
text: '你是「斗鱼直播运营日报助手」。
当前是回退链路,请稳定输出运营版完整日报正文。
只根据输入材料生成中文纯文本,不编造,不要使用代码块,不要超过 max_length。
'
- id: daily_user_2
role: user
text: '【任务类型】
daily_report
【长度限制】
{{#200000001.max_length#}}
【system_prompt】
{{#200000001.system_prompt#}}
【user_prompt】
{{#200000001.user_prompt#}}
【report_payload_json】
{{#200000001.report_payload_json#}}
请直接输出运营版完整日报正文。
'
retry_config:
max_retries: 2
retry_enabled: true
retry_interval: 1000
selected: false
title: 运营日报回退 LLM
type: llm
vision:
enabled: false
height: 118
id: '200000201'
position:
x: 1010
y: 0
positionAbsolute:
x: 1010
y: 0
selected: false
sourcePosition: right
targetPosition: left
type: custom
width: 242
- data:
context:
enabled: false
variable_selector: []
# 弹幕总结回退模型:
# 失败时继续保持“短摘要+现场感”目标,不让回退模型输出成长文复盘。
model:
completion_params:
temperature: 0.2
mode: chat
name: gpt-5.4
provider: langgenius/openai_api_compatible/openai_api_compatible
prompt_template:
- id: danmu_system_2
role: system
text: '你是「斗鱼直播弹幕总结助手」。
当前是回退链路,请稳定输出图片上半部分使用的弹幕总结。
只根据输入材料生成中文纯文本,不编造,不要使用代码块,不要写运营分析,不要超过 max_length。
'
- id: danmu_user_2
role: user
text: '【任务类型】
danmu_summary
【长度限制】
{{#200000001.max_length#}}
【system_prompt】
{{#200000001.system_prompt#}}
【user_prompt】
{{#200000001.user_prompt#}}
【report_payload_json】
{{#200000001.report_payload_json#}}
请直接输出弹幕总结结果。
'
retry_config:
max_retries: 2
retry_enabled: true
retry_interval: 1000
selected: false
title: 弹幕总结回退 LLM
type: llm
vision:
enabled: false
height: 118
id: '200000202'
position:
x: 1010
y: 210
positionAbsolute:
x: 1010
y: 210
selected: false
sourcePosition: right
targetPosition: left
type: custom
width: 242
- data:
context:
enabled: false
variable_selector: []
# 粉丝日报回退模型:
# 保持欢乐、现场、整活的风格要求,减少回退链路把粉丝版写成运营版的风险。
model:
completion_params:
temperature: 0.3
@@ -357,45 +826,23 @@ workflow:
name: gpt-5.4
provider: langgenius/openai_api_compatible/openai_api_compatible
prompt_template:
- id: 00000000-0000-0000-0000-000000000001
- id: fans_system_2
role: system
text: '你是「斗鱼直播日报助手」。
text: '你是「斗鱼直播粉丝乐子日报助手」。
你会收到 task_type、提示词和结构化弹幕材料
当前是回退链路,请稳定输出单独给粉丝看的欢乐恶搞日报
输出总原则:
1. 只根据给定材料生成内容,不编造。
2. 使用中文自然表达,不要输出代码块。
3. 输出纯文本,不要添加额外前后缀说明。
4. 严格遵守长度约束:不超过 max_length。
任务路由规则:
- 当 task_type=danmu_summary输出“弹幕总结”风格偏现场氛围、观众情绪与高频梗不写运营策略。
- 当 task_type=daily_report输出“完整日报正文”风格包含主线、运营观察、热点时段、高频梗等。
- 当 task_type=fans_daily_report输出“粉丝向乐子日报”风格整体要开心、欢乐、带一点整活气质
更像群友复盘直播间名场面;不要写运营分析,不要出现策略、转化、建议等运营词。
若 system_prompt 非空,优先遵循其格式和结构要求。
只根据输入材料生成中文纯文本,不编造,不要使用代码块,不要写运营分析,不要超过 max_length。
'
- id: 00000000-0000-0000-0000-000000000002
- id: fans_user_2
role: user
text: '【task_type
text: '【任务类型
{{#200000001.task_type#}}
fans_daily_report
【长度限制 max_length
【长度限制】
{{#200000001.max_length#}}
@@ -410,45 +857,31 @@ workflow:
{{#200000001.user_prompt#}}
【query兼容字段
{{#200000001.query#}}
【meta】
room_id={{#200000001.room_id#}}, anchor_day={{#200000001.anchor_day#}},
nickname={{#200000001.nickname#}}
【report_payload_json】
{{#200000001.report_payload_json#}}
按上述信息直接产出最终结果
如果 task_type=fans_daily_report请优先保留“现场弹幕感”和“群友整活感”
让输出明显区别于运营版日报。
直接输出粉丝向乐子日报
'
retry_config:
max_retries: 3
max_retries: 2
retry_enabled: true
retry_interval: 1000
selected: false
title: LLM (1)
title: 粉丝日报回退 LLM
type: llm
vision:
enabled: false
height: 118
id: '17766504655450'
id: '200000203'
position:
x: 704
y: 257
x: 1010
y: 440
positionAbsolute:
x: 704
y: 257
x: 1010
y: 440
selected: false
sourcePosition: right
targetPosition: left
@@ -457,27 +890,143 @@ workflow:
- data:
outputs:
- value_selector:
- '17766504655450'
- '200000101'
- text
value_type: string
variable: text
selected: false
title: 输出 2
title: 运营日报输出
type: end
height: 88
id: '1776650579720'
id: '200000301'
position:
x: 1046
y: 272
x: 1010
y: 110
positionAbsolute:
x: 1046
y: 272
x: 1010
y: 110
selected: false
sourcePosition: right
targetPosition: left
type: custom
width: 242
- data:
outputs:
- value_selector:
- '200000102'
- text
value_type: string
variable: text
selected: false
title: 弹幕总结输出
type: end
height: 88
id: '200000302'
position:
x: 1010
y: 320
positionAbsolute:
x: 1010
y: 320
selected: false
sourcePosition: right
targetPosition: left
type: custom
width: 242
- data:
outputs:
- value_selector:
- '200000103'
- text
value_type: string
variable: text
selected: false
title: 粉丝日报输出
type: end
height: 88
id: '200000303'
position:
x: 1010
y: 550
positionAbsolute:
x: 1010
y: 550
selected: false
sourcePosition: right
targetPosition: left
type: custom
width: 242
- data:
outputs:
- value_selector:
- '200000201'
- text
value_type: string
variable: text
selected: false
title: 运营日报回退输出
type: end
height: 88
id: '200000304'
position:
x: 1354
y: 0
positionAbsolute:
x: 1354
y: 0
selected: false
sourcePosition: right
targetPosition: left
type: custom
width: 242
- data:
outputs:
- value_selector:
- '200000202'
- text
value_type: string
variable: text
selected: false
title: 弹幕总结回退输出
type: end
height: 88
id: '200000305'
position:
x: 1354
y: 210
positionAbsolute:
x: 1354
y: 210
selected: false
sourcePosition: right
targetPosition: left
type: custom
width: 242
- data:
outputs:
- value_selector:
- '200000203'
- text
value_type: string
variable: text
selected: false
title: 粉丝日报回退输出
type: end
height: 88
id: '200000306'
position:
x: 1354
y: 440
positionAbsolute:
x: 1354
y: 440
selected: false
sourcePosition: right
targetPosition: left
type: custom
width: 242
viewport:
x: 231.0000000000001
y: 237
zoom: 0.7
x: 74
y: 74
zoom: 0.48
rag_pipeline_variables: []