docs(详细设计): 新增飞书通知设计
This commit is contained in:
78
docs/详细设计/skill/飞书通知编排Skill.md
Normal file
78
docs/详细设计/skill/飞书通知编排Skill.md
Normal file
@@ -0,0 +1,78 @@
|
||||
# 飞书通知编排Skill 设计
|
||||
|
||||
## 1. Skill 定位
|
||||
|
||||
`飞书通知编排Skill` 是第七步工作流的总入口 Skill,负责组织飞书触发上下文解析、通知上下文加载、责任人映射、消息摘要生成、消息发送和回执记录。
|
||||
|
||||
英文实现标识建议使用 `FeishuNotificationOrchestrateSkill`。
|
||||
|
||||
## 2. 输入
|
||||
|
||||
```python
|
||||
@dataclass
|
||||
class FeishuNotificationOrchestrateInput:
|
||||
batch_id: int
|
||||
scenario_id: str
|
||||
trigger_source: str
|
||||
feishu_chat_id: str
|
||||
feishu_message_id: str | None = None
|
||||
notify_owner: bool = True
|
||||
include_web_link: bool = True
|
||||
```
|
||||
|
||||
## 3. 输出
|
||||
|
||||
```python
|
||||
@dataclass
|
||||
class FeishuNotificationOrchestrateOutput:
|
||||
report_type: str
|
||||
batch_id: int
|
||||
send_status: str
|
||||
mentioned_users: list[dict]
|
||||
receipt: dict
|
||||
audit_id: int | None = None
|
||||
```
|
||||
|
||||
## 4. 依赖 Skill
|
||||
|
||||
1. `飞书任务入口解析Skill`
|
||||
2. `飞书责任人映射Skill`
|
||||
3. `飞书消息摘要生成Skill`
|
||||
4. `飞书消息发送Skill`
|
||||
5. `飞书回执记录Skill`
|
||||
|
||||
## 5. 核心方法
|
||||
|
||||
### 5.1 `run(input) -> FeishuNotificationOrchestrateOutput`
|
||||
|
||||
主入口方法。
|
||||
|
||||
### 5.2 `load_notification_context(input) -> NotificationContext`
|
||||
|
||||
加载风险报告、导出报告和 Web 链接。
|
||||
|
||||
### 5.3 `build_notification_payload(context) -> dict`
|
||||
|
||||
构建消息载荷。
|
||||
|
||||
## 6. 技术实现
|
||||
|
||||
使用技术:
|
||||
|
||||
1. Tool Registry
|
||||
2. 飞书 OpenAPI / MCP
|
||||
3. Django ORM
|
||||
4. Audit 服务
|
||||
|
||||
## 7. 异常处理
|
||||
|
||||
1. 风险报告缺失:发送提示消息。
|
||||
2. 飞书 chat_id 缺失:任务失败。
|
||||
3. 发送失败:记录失败回执。
|
||||
|
||||
## 8. 测试要点
|
||||
|
||||
1. 能生成飞书通知报告。
|
||||
2. 能串联责任人映射和消息发送。
|
||||
3. 发送失败可记录审计。
|
||||
|
||||
Reference in New Issue
Block a user