1.3 KiB
1.3 KiB
飞书回执记录Skill 设计
1. Skill 定位
飞书回执记录Skill 负责记录飞书消息发送结果、通知对象、消息 ID、失败原因和审计载荷。
英文实现标识建议使用 FeishuReceiptRecordSkill。
2. 输入
@dataclass
class FeishuReceiptRecordInput:
batch_id: int
send_result: dict
mention_targets: list[dict]
notification_payload: dict
trigger_context: dict
3. 输出
@dataclass
class FeishuReceiptRecordOutput:
notification_record_id: int
audit_payload: dict
status: str
4. 核心方法
4.1 run(input) -> FeishuReceiptRecordOutput
主入口方法。
4.2 create_notification_record(input) -> FeishuNotificationRecord
创建通知记录。
4.3 build_audit_payload(record) -> dict
生成审计载荷。
4.4 record_audit(payload) -> AuditLog
写入审计。
5. 技术实现
使用技术:
- Django ORM
- JSONField
- Audit 服务
6. 异常处理
- 记录写入失败:返回系统错误。
- 审计写入失败:保留通知记录并标记警告。
- 发送失败:仍记录失败回执。
7. 测试要点
- 成功发送可记录 message_id。
- 失败发送可记录错误。
- 审计载荷包含触发来源。
- 提及用户列表可保存。