新增斗鱼主播背景画像Redis缓存与Dify分支\n\n- 为斗鱼插件补充房间背景画像的Redis读写能力与TTL配置\n- 新增基于LLM生成主播背景画像JSON并回写Redis的链路\n- 将自动画像合并进room_context并在日报生成前预热缓存\n- 扩展Dify工作流,新增room_background_profile主分支与回退分支\n- 更新斗鱼配置示例与工作流文档,说明背景画像缓存用法

This commit is contained in:
liuwei
2026-04-27 13:04:13 +08:00
parent 889ce5acdd
commit 033fc1202d
4 changed files with 915 additions and 17 deletions

View File

@@ -1,5 +1,5 @@
app:
description: 斗鱼直播日报、弹幕总结粉丝乐子日报工作流
description: 斗鱼直播日报、弹幕总结粉丝乐子日报与房间背景画像工作流
icon: 🤖
icon_background: '#FFEAD5'
mode: workflow
@@ -99,6 +99,18 @@ workflow:
targetHandle: target
type: custom
zIndex: 0
- data:
isInIteration: false
isInLoop: false
sourceType: if-else
targetType: llm
id: 200000010-room-background-profile-case-200000104-target
source: '200000010'
sourceHandle: room_background_profile_case
target: '200000104'
targetHandle: target
type: custom
zIndex: 0
- data:
isInIteration: false
isInLoop: false
@@ -122,6 +134,41 @@ workflow:
targetHandle: target
type: custom
zIndex: 0
- data:
isInIteration: false
isInLoop: false
sourceType: llm
targetType: end
id: 200000104-source-200000307-target
source: '200000104'
sourceHandle: source
target: '200000307'
targetHandle: target
type: custom
zIndex: 0
- data:
isInLoop: false
sourceType: llm
targetType: llm
id: 200000104-fail-branch-200000204-target
source: '200000104'
sourceHandle: fail-branch
target: '200000204'
targetHandle: target
type: custom
zIndex: 0
- data:
isInIteration: false
isInLoop: false
sourceType: llm
targetType: end
id: 200000204-source-200000308-target
source: '200000204'
sourceHandle: source
target: '200000308'
targetHandle: target
type: custom
zIndex: 0
- data:
isInIteration: false
isInLoop: false
@@ -245,9 +292,10 @@ workflow:
# task_type 是整个工作流的业务路由开关:
# 1. daily_report运营版完整日报正文
# 2. danmu_summary运营版图片上半部分弹幕总结
# 3. fans_daily_report粉丝向欢乐恶搞日报
# 3. fans_daily_report粉丝向欢乐恶搞日报
# 4. room_background_profile主播/房间背景画像 JSON。
- default: daily_report
hint: daily_report / danmu_summary / fans_daily_report
hint: daily_report / danmu_summary / fans_daily_report / room_background_profile
label: task_type
max_length: 255
options: []
@@ -333,6 +381,17 @@ workflow:
width: 242
- data:
cases:
- case_id: room_background_profile_case
conditions:
- comparison_operator: contains
id: room_background_profile_case_cond
value: room_background_profile
varType: string
variable_selector:
- '200000001'
- task_type
id: room_background_profile_case
logical_operator: and
- case_id: danmu_summary_case
conditions:
- comparison_operator: contains
@@ -671,6 +730,98 @@ workflow:
targetPosition: left
type: custom
width: 242
- data:
context:
enabled: false
variable_selector: []
# 背景画像分支:
# 1. 只服务 room_background_profile
# 2. 优先整理公开资料与输入材料,输出结构化 JSON
# 3. 不确定时宁可留空,也不要编职业经历或圈内关系。
error_strategy: fail-branch
model:
completion_params:
temperature: 0.1
mode: chat
name: grok-4
provider: langgenius/openai_api_compatible/openai_api_compatible
prompt_template:
- id: background_system_1
role: system
text: '你是「斗鱼直播间背景画像助手」。
你的唯一任务是输出主播/房间背景画像 JSON。
输出原则:
1. 只输出 JSON 对象,不要使用代码块,不要输出解释文字。
2. 如果当前工作流已接入联网、检索或知识库能力,请优先检索公开资料后再整理。
3. 如果没有检索能力,只能根据输入材料做保守推断,不确定字段必须留空。
4. 不要把其他同名主播、选手或解说的经历串到当前房间。
5. 如果主播不是 Dota2 主播,也要按其真实领域整理,不要强行往 Dota2 上靠。
6. confidence 只能是 low / medium / high。
7. 如果 system_prompt 非空,优先遵循其中的补充规则。
'
- id: background_user_1
role: user
text: '【任务类型】
room_background_profile
【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#}}
请只输出背景画像 JSON。
'
retry_config:
max_retries: 2
retry_enabled: true
retry_interval: 1000
selected: false
title: 背景画像 LLM
type: llm
vision:
enabled: false
height: 172
id: '200000104'
position:
x: 664
y: 650
positionAbsolute:
x: 664
y: 650
selected: false
sourcePosition: right
targetPosition: left
type: custom
width: 242
- data:
context:
enabled: false
@@ -821,6 +972,76 @@ workflow:
targetPosition: left
type: custom
width: 242
- data:
context:
enabled: false
variable_selector: []
# 背景画像回退模型:
# 失败时继续保持“只出 JSON、宁可留空不乱编”的保守策略。
model:
completion_params:
temperature: 0.05
mode: chat
name: gpt-5.4
provider: langgenius/openai_api_compatible/openai_api_compatible
prompt_template:
- id: background_system_2
role: system
text: '你是「斗鱼直播间背景画像助手」。
当前是回退链路,请稳定输出背景画像 JSON。
只输出 JSON 对象,不要使用代码块,不要输出额外说明。
如果证据不足或重名风险较高字段留空confidence 设为 lowneeds_human_review 设为 true。
'
- id: background_user_2
role: user
text: '【任务类型】
room_background_profile
【system_prompt】
{{#200000001.system_prompt#}}
【user_prompt】
{{#200000001.user_prompt#}}
【report_payload_json】
{{#200000001.report_payload_json#}}
请只输出背景画像 JSON。
'
retry_config:
max_retries: 2
retry_enabled: true
retry_interval: 1000
selected: false
title: 背景画像回退 LLM
type: llm
vision:
enabled: false
height: 118
id: '200000204'
position:
x: 1010
y: 650
positionAbsolute:
x: 1010
y: 650
selected: false
sourcePosition: right
targetPosition: left
type: custom
width: 242
- data:
context:
enabled: false
@@ -1034,6 +1255,52 @@ workflow:
targetPosition: left
type: custom
width: 242
- data:
outputs:
- value_selector:
- '200000104'
- text
value_type: string
variable: text
selected: false
title: 背景画像输出
type: end
height: 88
id: '200000307'
position:
x: 1010
y: 760
positionAbsolute:
x: 1010
y: 760
selected: false
sourcePosition: right
targetPosition: left
type: custom
width: 242
- data:
outputs:
- value_selector:
- '200000204'
- text
value_type: string
variable: text
selected: false
title: 背景画像回退输出
type: end
height: 88
id: '200000308'
position:
x: 1354
y: 650
positionAbsolute:
x: 1354
y: 650
selected: false
sourcePosition: right
targetPosition: left
type: custom
width: 242
viewport:
x: 74
y: 74