69 lines
1.3 KiB
Markdown
69 lines
1.3 KiB
Markdown
# 飞书消息摘要生成Skill 设计
|
|
|
|
## 1. Skill 定位
|
|
|
|
`飞书消息摘要生成Skill` 负责将风险报告、导出报告和责任人信息组装为飞书文本消息或互动卡片。
|
|
|
|
英文实现标识建议使用 `FeishuMessageSummaryBuildSkill`。
|
|
|
|
## 2. 输入
|
|
|
|
```python
|
|
@dataclass
|
|
class FeishuMessageSummaryBuildInput:
|
|
risk_report: dict
|
|
word_export_report: dict | None
|
|
mention_targets: list[dict]
|
|
web_detail_url: str | None
|
|
```
|
|
|
|
## 3. 输出
|
|
|
|
```python
|
|
@dataclass
|
|
class FeishuMessageSummaryBuildOutput:
|
|
message_type: str
|
|
payload: dict
|
|
summary_text: str
|
|
```
|
|
|
|
## 4. 核心方法
|
|
|
|
### 4.1 `run(input) -> FeishuMessageSummaryBuildOutput`
|
|
|
|
主入口方法。
|
|
|
|
### 4.2 `build_summary_text(report) -> str`
|
|
|
|
生成文本摘要。
|
|
|
|
### 4.3 `build_interactive_card(report, mentions, url) -> dict`
|
|
|
|
生成互动卡片。
|
|
|
|
### 4.4 `build_mentions(mention_targets) -> list[dict]`
|
|
|
|
生成 @ 用户片段。
|
|
|
|
## 5. 技术实现
|
|
|
|
使用技术:
|
|
|
|
1. 飞书卡片 JSON
|
|
2. 文本模板
|
|
3. 可选 LLM 摘要
|
|
|
|
## 6. 异常处理
|
|
|
|
1. 风险报告为空:生成提示消息。
|
|
2. Web 链接为空:卡片不展示按钮。
|
|
3. 责任人为空:不生成 @。
|
|
|
|
## 7. 测试要点
|
|
|
|
1. 能生成风险摘要。
|
|
2. 能生成卡片 payload。
|
|
3. 能包含 @ 用户。
|
|
4. 无链接时消息仍可发送。
|
|
|