feat: show feishu notification status

This commit is contained in:
2026-06-07 22:13:56 +08:00
parent cbc7493df8
commit 1a1b3ee9d4
9 changed files with 191 additions and 5 deletions

View File

@@ -1,7 +1,7 @@
import pytest
from django.urls import reverse
from review_agent.models import Conversation, FileAttachment, FileSummaryBatch, Message, WorkflowNodeRun
from review_agent.models import Conversation, FileAttachment, FileSummaryBatch, Message, WorkflowNodeRun, WorkflowNotificationRecord
pytestmark = pytest.mark.django_db
@@ -223,6 +223,31 @@ def test_frontend_renders_workflow_error_messages():
assert ".workflow-error" in css
def test_file_summary_status_includes_feishu_notification(client, django_user_model):
user = django_user_model.objects.create_user(username="owner", password="pass")
conversation = Conversation.objects.create(user=user, title="会话")
batch = FileSummaryBatch.objects.create(conversation=conversation, user=user, batch_no="FS-FEISHU")
WorkflowNotificationRecord.objects.create(
workflow_type="file_summary",
workflow_batch_id=batch.pk,
workflow_batch_no=batch.batch_no,
workflow_status=batch.status,
dedupe_key=f"file_summary:{batch.pk}:{batch.status}",
trigger_user=user,
channel=WorkflowNotificationRecord.Channel.FEISHU_API,
target="负责人",
send_status=WorkflowNotificationRecord.SendStatus.SUCCESS,
message_title="自动汇总完成",
)
client.force_login(user)
response = client.get(f"/api/review-agent/file-summary/{batch.pk}/status/")
payload = response.json()
assert payload["latest_notification"]["status_label"] == "飞书通知已发送"
assert payload["notifications"][0]["target"] == "负责人"
def test_frontend_renders_workflow_batches_as_carousel():
script = open("static/js/app.js", encoding="utf-8").read()
css = open("static/css/login.css", encoding="utf-8").read()