Files
crm_project/dify/workflow_weekly_report.yml
T
hankin 423baff73b v0.1.0: CRM/ERP 系统内测版本 - 安全加固完成
- Docker bridge 网络隔离(8000 端口封死)
- Gunicorn 4 Worker 多进程
- Alembic 数据库迁移基线
- 日志轮转 20m×3
- JWT 密钥 + DB 密码 + CORS 收紧
- 3-2-1 备份链路(NAS + R740-B 冷备)
- 连接池 pool_pre_ping + pool_recycle=3600
2026-03-16 07:31:37 +00:00

235 lines
6.7 KiB
YAML

app:
description: '拉取指定销售的本周销售日志,AI 提炼为结构化 Markdown 周报,写入报告草稿表'
icon: "\U0001F4CA"
icon_background: '#D5F5F6'
mode: workflow
name: '周报自动生成'
use_icon_as_answer_icon: false
kind: app
version: 0.1.3
workflow:
conversation_variables: []
environment_variables: []
features:
file_upload:
image:
enabled: false
opening_statement: ''
retriever_resource:
enabled: false
sensitive_word_avoidance:
enabled: false
suggested_questions: []
suggested_questions_after_answer:
enabled: false
text_to_speech:
enabled: false
graph:
edges:
- data:
sourceType: start
targetType: http-request
id: edge-start-to-fetch
source: start
target: http-fetch-logs
type: custom
- data:
sourceType: http-request
targetType: llm
id: edge-fetch-to-llm
source: http-fetch-logs
target: llm-report
type: custom
- data:
sourceType: llm
targetType: http-request
id: edge-llm-to-save
source: llm-report
target: http-save-report
type: custom
- data:
sourceType: http-request
targetType: end
id: edge-save-to-end
source: http-save-report
target: end
type: custom
nodes:
# ── 开始节点 ──
- data:
desc: '接收用户ID和日期范围'
title: 开始
type: start
variables:
- label: user_id
max_length: 100
required: true
type: text-input
variable: user_id
- label: period_start
max_length: 20
required: true
type: text-input
variable: period_start
- label: period_end
max_length: 20
required: true
type: text-input
variable: period_end
- label: report_type
max_length: 10
required: false
type: text-input
variable: report_type
default: weekly
height: 90
id: start
position:
x: 80
y: 282
type: start
width: 244
# ── HTTP 拉取日志 ──
- data:
desc: '从 ERP 后端拉取该销售本周的所有日志'
title: '拉取销售日志'
type: http-request
authorization:
config:
api_key: '' # ← 导入后填写 Bearer token
header: Authorization
type: bearer
type: api-key
body:
data: ''
type: none
headers: ''
method: get
params: 'user_id={{#start.user_id#}}&start_date={{#start.period_start#}}&end_date={{#start.period_end#}}'
timeout:
max_connect_timeout: 10
max_read_timeout: 30
max_write_timeout: 30
# ⚠️ 导入后修改为你的实际 ERP 地址
url: 'http://192.168.1.100:8000/api/sales-logs'
height: 98
id: http-fetch-logs
position:
x: 380
y: 282
type: http-request
width: 244
# ── LLM 周报生成 ──
- data:
desc: '基于销售日志生成结构化周报'
# ⚠️ 导入后请选择你 Dify 中配置的模型
model:
completion_params:
temperature: 0.5
max_tokens: 4096
mode: chat
name: qwen3.5 # ← 导入后改为实际模型名称
provider: ollama # ← 改为实际供应商
prompt_template:
- role: system
text: |
你是一个销售管理助手,擅长撰写专业的销售周报。
请根据以下销售日志,撰写一份结构化的 Markdown 周报,包含:
## 📋 本周工作概要
(2-3 句话总结本周整体工作)
## 📊 客户跟进情况
| 客户 | 跟进方式 | 进展 | 下一步 |
|------|----------|------|--------|
(按日志整理每位客户的跟进表格)
## 🎯 重点成果
- (列出本周的关键成果,如签单、推进等)
## ⚠️ 问题与风险
- (列出遇到的困难和风险点)
## 📅 下周计划
- (根据日志中提到的下一步规划整理)
要求:语言简洁专业,数据准确。
- role: user
text: |
以下是本周({{#start.period_start#}} 至 {{#start.period_end#}})的销售日志记录:
{{#http-fetch-logs.body#}}
title: '生成周报'
type: llm
height: 98
id: llm-report
position:
x: 680
y: 282
type: llm
width: 244
# ── HTTP 保存周报草稿 ──
- data:
desc: '将生成的周报写入 ERP 报告草稿表'
title: '保存周报草稿'
type: http-request
authorization:
config:
api_key: '' # ← 导入后填写 Bearer token
header: Authorization
type: bearer
type: api-key
body:
data: |
{
"author_id": "{{#start.user_id#}}",
"report_type": "{{#start.report_type#}}",
"period_start": "{{#start.period_start#}}",
"period_end": "{{#start.period_end#}}",
"content_md": "{{#llm-report.text#}}"
}
type: json
headers: ''
method: post
params: ''
timeout:
max_connect_timeout: 10
max_read_timeout: 30
max_write_timeout: 30
# ⚠️ 导入后修改为你的实际 ERP 地址
url: 'http://192.168.1.100:8000/api/reports/drafts'
height: 98
id: http-save-report
position:
x: 980
y: 282
type: http-request
width: 244
# ── 结束节点 ──
- data:
desc: ''
outputs:
- value_selector:
- llm-report
- text
variable: report_markdown
- value_selector:
- http-save-report
- status_code
variable: save_status
title: 结束
type: end
height: 90
id: end
position:
x: 1280
y: 282
type: end
width: 244
hash: ''