From ea2c01532e68230f64053bba41ed6ff1fc192dc8 Mon Sep 17 00:00:00 2001 From: liuwei Date: Mon, 27 Apr 2026 12:34:06 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B0=86=E6=96=97=E9=B1=BC=E6=97=A5=E6=8A=A5Di?= =?UTF-8?q?fy=E5=B7=A5=E4=BD=9C=E6=B5=81=E6=94=B9=E4=B8=BA=E6=8C=89?= =?UTF-8?q?=E4=BB=BB=E5=8A=A1=E7=B1=BB=E5=9E=8B=E5=88=86=E6=94=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 1. 在斗鱼日报 Dify 工作流中新增 if-else 节点,按 daily_report、danmu_summary、fans_daily_report 做真实业务分支。\n2. 为运营日报、弹幕总结、粉丝日报分别拆分主 LLM 与回退 LLM,减少不同文风互相污染。\n3. 更新斗鱼 Dify 接入文档,改为分支版工作流说明,明确当前推荐结构与验证方式。 --- docs/dify_douyu_daily_report_workflow.md | 190 +++--- plugins/douyu/斗鱼日报AI.yml | 833 +++++++++++++++++++---- 2 files changed, 795 insertions(+), 228 deletions(-) diff --git a/docs/dify_douyu_daily_report_workflow.md b/docs/dify_douyu_daily_report_workflow.md index 940ebe5..b8ad8e7 100644 --- a/docs/dify_douyu_daily_report_workflow.md +++ b/docs/dify_douyu_daily_report_workflow.md @@ -1,130 +1,148 @@ -# Dify 工作流设计:斗鱼日报最新接入说明 +# Dify 工作流设计:斗鱼日报分支版接入说明 ## 1. 目标 -- 让 `plugins/douyu` 统一通过 Dify Workflow 处理三类斗鱼日报任务。 -- 保持“一个 scene + 一个 workflow” 的接法,减少插件侧和 Dify 侧的维护成本。 -- 让运营版日报、弹幕总结、粉丝向乐子日报共用一套工作流入口,但通过 `task_type` 做风格路由。 +- 让 `plugins/douyu` 继续通过一个 Dify Workflow 接收斗鱼日报任务。 +- 但在 Workflow 内部按 `task_type` 做真正的 LLM 分支,而不是让一个通用 LLM 节点同时处理三种风格。 +- 降低运营日报、弹幕总结、粉丝乐子日报之间的风格串台和幻觉风险。 -## 2. 当前仓库里的真实接法 -当前项目不是“多个 workflow 按业务拆开”,而是: +## 2. 当前推荐结构 +当前推荐的是: 1. 插件侧固定走场景 `douyu.daily_report` -2. 场景路由到 `llm.backends.dify_workflow_douyu_daily_report` -3. Dify 端使用一个 Workflow 应用统一接收不同 `task_type` +2. 该场景路由到 `dify_workflow_douyu_daily_report` +3. Dify Workflow 中先读取 `task_type` +4. 通过 `if-else` 节点按业务分支 +5. 每个分支走自己的主 LLM +6. 每个主 LLM 再各自挂一个失败回退 LLM -对应文件: -- 场景路由配置见 [config.yaml](d:/learn/abot/config.yaml:130) -- 斗鱼插件配置见 [plugins/douyu/config.toml](d:/learn/abot/plugins/douyu/config.toml:34) -- 最新工作流导出见 [plugins/douyu/斗鱼日报AI.yml](d:/learn/abot/plugins/douyu/斗鱼日报AI.yml:1) +这样做的原因: +- 每个分支 prompt 更短、更纯 +- 每个模型只处理单一输出目标 +- 更不容易把粉丝日报写成运营复盘 +- 更不容易把弹幕总结写成长日报 ## 3. 项目侧输入约定 -斗鱼插件会向 Dify Workflow 发送以下输入: +斗鱼插件传入的核心字段如下: - `task_type` - 当前支持三个值: - `daily_report`:运营版完整日报正文 - `danmu_summary`:运营版图片上半部分弹幕总结 - `fans_daily_report`:粉丝向欢乐恶搞日报 - `query` - 兼容 Dify workflow 的通用输入字段,值通常等于 `user_prompt` - `system_prompt` - 插件侧拼好的系统提示词 - `user_prompt` - 插件侧拼好的用户提示词 - `report_payload_json` - 结构化日报材料 JSON 字符串 - `room_id` - 房间号 - `anchor_day` - 报告日期,例如 `2026-04-27` - `nickname` - 主播昵称 - `max_length` - 最大输出长度,项目侧当前默认传字符串 -说明: -- 斗鱼插件目前默认 `include_structured_inputs = false`,见 [plugins/douyu/config.toml](d:/learn/abot/plugins/douyu/config.toml:37) -- 所以最稳的做法是至少在工作流中保留 `report_payload_json` 这个字符串输入 +对应代码见: +- 输入封装 [plugins/douyu/main.py](d:/learn/abot/plugins/douyu/main.py:2144) +- 运营日报调用 [plugins/douyu/main.py](d:/learn/abot/plugins/douyu/main.py:2386) +- 弹幕总结调用 [plugins/douyu/main.py](d:/learn/abot/plugins/douyu/main.py:2231) +- 粉丝日报调用 [plugins/douyu/main.py](d:/learn/abot/plugins/douyu/main.py:2254) -## 4. 最新工作流结构 -当前最新导出的 Workflow 结构更接近“提示词路由 + 失败回退”,不是旧版文档里的 Code 节点拼装方案。 +## 4. 工作流图结构 +最新推荐图结构如下: -### 4.1 节点结构 1. `Start` -2. 主 `LLM` -3. `End` -4. 主 `LLM` 的 `fail-branch` 指向备用 `LLM` -5. 备用 `LLM` 再输出到第二个 `End` +2. `if-else` 节点:按 `task_type` 分三条业务线 +3. `运营日报 LLM` +4. `弹幕总结 LLM` +5. `粉丝日报 LLM` +6. 每条业务线各自一个 `fail-branch` 回退 LLM +7. 每条成功路径和回退路径各自输出到 `End.text` -### 4.2 设计意图 -- 主模型先尝试生成结果 -- 如果主模型节点失败,自动切到备用模型 -- 两个 LLM 节点使用相同的输入协议和相近的提示词规则 -- 业务类型不依赖图上的条件分支,而是依赖 `task_type + system_prompt + user_prompt` +仓库导出文件见: +- [plugins/douyu/斗鱼日报AI.yml](d:/learn/abot/plugins/douyu/%E6%96%97%E9%B1%BC%E6%97%A5%E6%8A%A5AI.yml) -## 5. 是否必须在 Dify 里做业务分支 -结论:当前这套最新版本里,不是必须。 +## 5. 为什么不用“一个 LLM + task_type 路由” +这种旧方式能跑,但有几个问题: -原因: -- 插件侧已经针对三类任务分别构造了不同的 `system_prompt` 和 `user_prompt` -- 工作流里也已经接收 `task_type` -- 只要 LLM 节点提示词里明确说明三类任务的输出要求,一个 workflow 就能稳定工作 +- prompt 过于通用,模型会记住多个风格要求 +- 粉丝版容易混入“运营观察” +- 弹幕总结容易长成“完整日报” +- 回退模型也只能吃同一套混合规则 -更准确地说: -- 现在推荐的是“提示词路由” -- 不是“图上 condition 节点硬分叉” +分支版的好处是: +- `daily_report` 只看到运营日报规则 +- `danmu_summary` 只看到弹幕总结规则 +- `fans_daily_report` 只看到粉丝乐子日报规则 -## 6. 什么时候建议再升级成图分支 -如果后续出现下面任一情况,再考虑在 Dify 图里加 `If/Else` 或 `Code + Condition`: +## 6. if-else 分支规则 +建议 `if-else` 节点至少包含三个 case: -- `fans_daily_report` 想使用和运营日报完全不同的模型 -- 三类任务的温度、最大输出长度、后处理逻辑差异很大 -- 你希望在 Dify 控制台里直观看到每类任务的单独节点与耗时 -- 你希望未来继续加第四类、第五类斗鱼子任务 +1. `danmu_summary_case` +2. `fans_daily_report_case` +3. `daily_report_case` -在目前这版里,先不加图分支反而更稳,改动面更小。 +推荐默认 `false` 分支回到 `daily_report`,因为项目侧默认值就是 `daily_report`。 -## 7. 最新工作流里必须补齐的点 -如果你使用的是本仓库里的最新版工作流导出,那么至少要确保: +## 7. 每个分支的职责 +### 7.1 运营日报分支 +- 只输出完整日报正文 +- 重点写主线、关注点、运营观察、热点时段、高频梗 +- 不承担粉丝整活风格 -1. `Start.task_type` 的说明已经包含 `fans_daily_report` -2. 主 `LLM` 的系统提示词里已经出现三类任务的路由规则 -3. 备用 `LLM` 的系统提示词也同步包含三类任务的路由规则 -4. 输出字段仍然固定为 `text` +### 7.2 弹幕总结分支 +- 只输出图片上半部分摘要 +- 重点写现场氛围、观众情绪、高频梗、节奏变化 +- 不写运营分析 -本仓库已经把这些更新写进 [plugins/douyu/斗鱼日报AI.yml](d:/learn/abot/plugins/douyu/斗鱼日报AI.yml:128)。 +### 7.3 粉丝日报分支 +- 只输出单独的粉丝向乐子日报 +- 重点写欢乐、现场感、接梗、名场面 +- 不写策略、建议、转化、数据表现 -## 8. 推荐的 LLM 路由规则 -主 LLM 和备用 LLM 的系统提示词都建议具备这三条兜底规则: +## 8. 回退 LLM 的设计建议 +不要把三条主分支都挂到同一个通用回退模型。 -- 当 `task_type=danmu_summary` - 输出“弹幕总结”风格,偏现场氛围、观众情绪与高频梗,不写运营策略。 +推荐做法: +- 运营日报主分支失败 -> 运营日报回退 LLM +- 弹幕总结主分支失败 -> 弹幕总结回退 LLM +- 粉丝日报主分支失败 -> 粉丝日报回退 LLM -- 当 `task_type=daily_report` - 输出“完整日报正文”风格,包含主线、运营观察、热点时段、高频梗等。 +这样回退时也不会风格跑偏。 -- 当 `task_type=fans_daily_report` - 输出“粉丝向乐子日报”风格,整体要开心、欢乐、带一点整活气质,更像群友复盘直播间名场面;不要写运营分析,不要出现策略、转化、建议等运营词。 +## 9. 工作流导出里已经完成的优化 +本仓库里的最新版导出已经做了这些事: -## 9. 项目侧对应代码位置 -如果你后续还要联调,这几个方法最关键: +1. 新增 `if-else` 节点按 `task_type` 做真实分支 +2. 为三类任务拆分主 LLM +3. 为三类任务拆分回退 LLM +4. 各分支提示词单独收敛,不再共享一段总 prompt +5. 输出仍统一为 `text` -- Dify 输入封装见 [plugins/douyu/main.py](d:/learn/abot/plugins/douyu/main.py:2144) -- 运营版日报任务调用见 [plugins/douyu/main.py](d:/learn/abot/plugins/douyu/main.py:2386) -- 弹幕总结任务调用见 [plugins/douyu/main.py](d:/learn/abot/plugins/douyu/main.py:2231) -- 粉丝日报任务调用见 [plugins/douyu/main.py](d:/learn/abot/plugins/douyu/main.py:2254) +## 10. 项目配置层是否需要改 +一般不用改 scene 这一层。 -## 10. 上线前检查 -1. 在 Dify 中重新导入或手动同步最新工作流配置。 -2. 确认 Workflow 的 `End` 输出变量名是 `text`。 -3. 先执行 `#强制斗鱼弹幕日报 2026-04-27`,验证运营版链路。 -4. 再执行 `#强制斗鱼粉丝日报 2026-04-27`,验证粉丝版链路。 -5. 如果某类结果语气不对,优先检查 Dify 中对应 LLM 节点的系统提示词是否已经包含 `fans_daily_report` 路由规则。 +当前项目仍然是: +- [plugins/douyu/config.toml](d:/learn/abot/plugins/douyu/config.toml:34) 使用 `scene = "douyu.daily_report"` +- [config.yaml](d:/learn/abot/config.yaml:130) 将该 scene 路由到 `dify_workflow_douyu_daily_report` -## 11. 一句建议 -当前这版最优先的不是“在图上拆很多分支”,而是保证: -- 插件传入的 `task_type` 正确 -- Workflow 导出里的两套 LLM 提示词都同步支持 `fans_daily_report` -- `workflow_output_key=text` 不变 +也就是说: +- 插件入口不变 +- 场景路由不变 +- 优化点集中在 Dify Workflow 内部 -这样成本最低,和你现在这份“最新 Dify 配置”也最一致。 +## 11. 上线前验证 +建议至少验证这三条: + +1. `#强制斗鱼弹幕日报 2026-04-27` + 目标:确认运营版只走运营正文分支 + +2. `#强制斗鱼粉丝日报 2026-04-27` + 目标:确认粉丝版不再混入运营分析 + +3. 手动触发 `danmu_summary` + 目标:确认摘要依旧短、像现场,不会拉成长文 + +## 12. 一句结论 +你现在这个判断是对的。 + +对斗鱼日报这种“同一份材料,多种输出风格”的任务来说: +- 插件侧用一个 scene 保持简单 +- Dify 侧用 `if-else + 多 LLM 分支` 保持稳定 + +这是比“一个 LLM 通吃三类任务”更稳、更高效的方案。 diff --git a/plugins/douyu/斗鱼日报AI.yml b/plugins/douyu/斗鱼日报AI.yml index 847348b..0ea3064 100644 --- a/plugins/douyu/斗鱼日报AI.yml +++ b/plugins/douyu/斗鱼日报AI.yml @@ -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: []