fix(regulatory): 将条件确认移入对话区
This commit is contained in:
@@ -43,6 +43,7 @@ def workspace(request: HttpRequest) -> HttpResponse:
|
||||
current = conversations.first()
|
||||
|
||||
workflow_cards = build_workflow_cards(current) if current else []
|
||||
condition_confirmation = build_condition_confirmation(workflow_cards)
|
||||
|
||||
return render(
|
||||
request,
|
||||
@@ -55,6 +56,7 @@ def workspace(request: HttpRequest) -> HttpResponse:
|
||||
"messages": current.messages.all() if current else [],
|
||||
"attachments": FileAttachment.objects.filter(conversation=current).order_by("original_name", "-version_no") if current else [],
|
||||
"workflow_cards": workflow_cards,
|
||||
"condition_confirmation": condition_confirmation,
|
||||
},
|
||||
)
|
||||
|
||||
@@ -154,6 +156,21 @@ def build_workflow_cards(conversation: Conversation) -> list[dict[str, object]]:
|
||||
return sorted(cards, key=lambda item: item["created_at"], reverse=True)[:5]
|
||||
|
||||
|
||||
def build_condition_confirmation(workflow_cards: list[dict[str, object]]) -> dict[str, object] | None:
|
||||
for card in workflow_cards:
|
||||
if (
|
||||
card.get("workflow_type") == "regulatory_review"
|
||||
and card.get("status") == RegulatoryReviewBatch.Status.WAITING_USER
|
||||
and card.get("condition_candidates")
|
||||
):
|
||||
return {
|
||||
"id": card["id"],
|
||||
"batch_no": card["batch_no"],
|
||||
"candidates": card["condition_candidates"],
|
||||
}
|
||||
return None
|
||||
|
||||
|
||||
def _format_risk_label(risk_summary: dict) -> str:
|
||||
parts = []
|
||||
labels = [
|
||||
|
||||
Reference in New Issue
Block a user