feat: 收口通知原因语义与留痕校验

This commit is contained in:
2026-06-04 03:44:04 +08:00
parent 742d5e9a42
commit dc86fc0e58
4 changed files with 79 additions and 2 deletions

View File

@@ -513,6 +513,49 @@ def test_feishu_notification_report_builds_notification_payload_with_receipt_and
assert result.notification_payload["receipt"]["message_id"] == "msg-3"
def test_notification_payload_normalizes_unsupported_notify_reason():
scenario = {
"id": "document_review",
"name": "注册审核智能体",
"agent": {
"role": "注册审核助手",
"goal": "输出通知结果",
"instructions": ["输出结构化通知结果"],
},
"rag": {"enabled": False},
"tools": [],
"output": {"type": "feishu_notification_report"},
}
provider_response = """
{
"batch_id": "SUB-20260604-004",
"conversation_id": "conv-004",
"notify_reason": "custom_reason",
"mentioned_users": ["ou_demo_1"],
"message_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-004",
"conversation_id": "conv-004",
"product_name": "产品D",
},
)
assert result.notification_payload["notify_reason"] == "task_completed"
def test_registration_word_export_report_preserves_formal_export_flag_and_blocked_items():
scenario = {
"id": "document_review",