feat: wire feishu notifications into workflows

This commit is contained in:
2026-06-07 22:09:47 +08:00
parent 820069f558
commit cbc7493df8
8 changed files with 301 additions and 1 deletions

View File

@@ -9,6 +9,7 @@ from review_agent.models import (
)
from review_agent.regulatory_review.services.export import build_markdown_report, build_result_payload
from review_agent.regulatory_review.services.feishu_notifier import create_mock_notifications
from review_agent.regulatory_review.workflow import RegulatoryWorkflowExecutor
pytestmark = pytest.mark.django_db
@@ -77,3 +78,32 @@ def test_notification_records_enter_reports(django_user_model):
assert "通知记录" in build_markdown_report(batch)
assert build_result_payload(batch)["notifications"][0]["channel"] == "mock"
def test_regulatory_completion_notification_uses_dispatcher(monkeypatch, django_user_model):
user = django_user_model.objects.create_user(username="owner", password="pass")
conversation = Conversation.objects.create(user=user, title="会话")
summary = FileSummaryBatch.objects.create(
conversation=conversation,
user=user,
batch_no="FS-NOTIFY-DISPATCH",
status=FileSummaryBatch.Status.SUCCESS,
)
batch = RegulatoryReviewBatch.objects.create(
conversation=conversation,
user=user,
source_summary_batch=summary,
batch_no="RR-NOTIFY-DISPATCH",
status=RegulatoryReviewBatch.Status.SUCCESS,
)
calls = []
monkeypatch.setattr(
"review_agent.regulatory_review.workflow.dispatch_workflow_notification",
lambda context: calls.append(context),
)
RegulatoryWorkflowExecutor(batch)._dispatch_completion_notification()
assert calls
assert calls[0].workflow_type == "regulatory_review"