feat(application-form-fill): 接入自动填表工作流触发

This commit is contained in:
2026-06-07 18:26:37 +08:00
parent e48d44f832
commit 8694f2d43e
6 changed files with 511 additions and 9 deletions

View File

@@ -0,0 +1,27 @@
from __future__ import annotations
from review_agent.application_form_fill.constants import WORKFLOW_TYPE
from review_agent.models import ApplicationFormFillBatch, WorkflowEvent
def record_event(
batch: ApplicationFormFillBatch,
event_type: str,
payload: dict | None = None,
) -> WorkflowEvent:
return WorkflowEvent.objects.create(
workflow_type=WORKFLOW_TYPE,
workflow_batch_id=batch.pk,
conversation=batch.conversation,
event_type=event_type,
payload=payload or {},
)
def serialize_event(event: WorkflowEvent) -> dict[str, object]:
return {
"id": event.pk,
"event_type": event.event_type,
"payload": event.payload,
"created_at": event.created_at.isoformat(),
}