feat: wire feishu notifications into workflows
This commit is contained in:
@@ -7,6 +7,8 @@ from review_agent.models import (
|
||||
ApplicationFormFillNotificationRecord,
|
||||
ExportedSummaryFile,
|
||||
)
|
||||
from review_agent.notifications.dispatcher import dispatch_workflow_notification
|
||||
from review_agent.notifications.workflow_adapters import build_application_form_fill_context
|
||||
|
||||
|
||||
def notify_completion(
|
||||
@@ -33,6 +35,13 @@ def notify_completion(
|
||||
retry_count=1,
|
||||
error_message="mock notification failed",
|
||||
)
|
||||
unified_error = ""
|
||||
try:
|
||||
unified_record = dispatch_workflow_notification(build_application_form_fill_context(batch))
|
||||
if unified_record.send_status == unified_record.SendStatus.FAILED:
|
||||
unified_error = unified_record.error_message
|
||||
except Exception as exc:
|
||||
unified_error = str(exc)
|
||||
return ApplicationFormFillNotificationRecord.objects.create(
|
||||
batch=batch,
|
||||
recipient=batch.user,
|
||||
@@ -41,5 +50,6 @@ def notify_completion(
|
||||
export_ids=export_ids,
|
||||
message_summary=message_summary,
|
||||
send_status=ApplicationFormFillNotificationRecord.SendStatus.SUCCESS,
|
||||
error_message=unified_error,
|
||||
sent_at=timezone.now(),
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user