fix(regulatory): 修复无标签文档适用条件回显

This commit is contained in:
2026-06-07 12:29:22 +08:00
parent 1b4a10b5ba
commit 9e27c4c684
8 changed files with 305 additions and 8 deletions

View File

@@ -9,6 +9,7 @@ from django.contrib.auth.decorators import login_required
from review_agent.models import FileSummaryBatch, RegulatoryReviewBatch, WorkflowNodeRun
from review_agent.regulatory_review.events import record_event
from review_agent.regulatory_review.services.info_extract import ensure_regulatory_condition_candidates
from review_agent.regulatory_review.services.rectification_review import review_missing_issues
from review_agent.regulatory_review.workflow import create_regulatory_review_batch, start_regulatory_review_workflow
@@ -19,6 +20,7 @@ def batch_status(request, batch_id: int):
batch = RegulatoryReviewBatch.objects.filter(pk=batch_id, user=request.user).first()
if not batch:
raise Http404("批次不存在。")
condition_candidates = ensure_regulatory_condition_candidates(batch)
nodes = WorkflowNodeRun.objects.filter(
workflow_type="regulatory_review",
workflow_batch_id=batch.pk,
@@ -45,12 +47,12 @@ def batch_status(request, batch_id: int):
for node in nodes
],
}
if batch.status == RegulatoryReviewBatch.Status.WAITING_USER and (batch.condition_json or {}).get("candidates"):
if batch.status == RegulatoryReviewBatch.Status.WAITING_USER and condition_candidates:
payload["condition_confirmation"] = {
"batch_id": batch.pk,
"batch_no": batch.batch_no,
"confirm_url": f"/api/review-agent/regulatory-review/{batch.pk}/conditions/",
"candidates": batch.condition_json["candidates"],
"candidates": condition_candidates,
}
return JsonResponse(payload)