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

@@ -5,6 +5,9 @@ from apps.documents.models import SubmissionBatch
from .models import AgentAuditLog, NotificationRecord
SUPPORTED_NOTIFY_REASONS = {"task_completed", "task_failed"}
def create_audit_log(
scenario_id: str,
scenario_name: str,
@@ -84,6 +87,8 @@ def create_notification_record(
V1 先把通知载荷和结果状态稳定落库,
真实飞书发送可在后续阶段接入。
"""
if notify_reason not in SUPPORTED_NOTIFY_REASONS:
raise ValueError(f"notify_reason 不受支持:{notify_reason}")
return NotificationRecord.objects.create(
batch_id=batch_id,
conversation_id=conversation_id,