feat: 打通通知回执与消息状态留痕

This commit is contained in:
2026-06-04 02:00:41 +08:00
parent a663543b37
commit 3280186625
4 changed files with 109 additions and 3 deletions

View File

@@ -460,3 +460,54 @@ owner_mappings:
assert result.notification_payload["notify_reason"] == "task_failed"
assert owner["owner_name"] == "孙七"
assert owner["feishu_open_id"] == "on_failed_1"
def test_feishu_notification_report_builds_notification_payload_with_receipt_and_node_status():
scenario = {
"id": "document_review",
"name": "注册审核智能体",
"agent": {
"role": "注册审核助手",
"goal": "输出通知结果",
"instructions": ["输出结构化通知结果"],
},
"rag": {"enabled": False},
"tools": [],
"output": {"type": "feishu_notification_report"},
}
provider_response = """
{
"batch_id": "SUB-20260604-003",
"conversation_id": "conv-003",
"notify_reason": "task_completed",
"mentioned_users": ["ou_demo_1"],
"message_status": "sent",
"web_detail_url": "https://example.com/audit/3",
"receipt": {
"message_id": "msg-3",
"status": "sent"
}
}
"""
class FakeProvider:
def generate(self, messages, response_format=None):
from agent_core.llm_provider import LLMResponse
return LLMResponse(content=provider_response, model_name="demo-model", success=True)
result = run_agent(
scenario,
"请生成通知结果",
options={
"llm_provider": FakeProvider(),
"batch_id": "SUB-20260604-003",
"conversation_id": "conv-003",
"product_name": "产品C",
},
)
assert result.node_results[7]["status"] == "已完成"
assert result.notification_payload["message_status"] == "sent"
assert result.notification_payload["web_detail_url"] == "https://example.com/audit/3"
assert result.notification_payload["receipt"]["message_id"] == "msg-3"