feat: 增强审核智能体页顶部上下文与提问模板

This commit is contained in:
2026-06-04 02:59:17 +08:00
parent 5fdcc31c74
commit a7cee4aa27
3 changed files with 85 additions and 0 deletions

View File

@@ -85,6 +85,8 @@ def detail(request, conversation_id: str):
active_node = "risk"
conversation.refresh_from_db()
workspace_summary = _build_workspace_summary(conversation, batch)
conversation_context = _build_conversation_context(conversation, batch, workspace_summary)
prompt_templates = _build_prompt_templates()
export_card = _build_export_card(result, conversation)
risk_card = _build_risk_card(result, conversation)
notify_card = _build_notify_card(result, conversation)
@@ -105,6 +107,8 @@ def detail(request, conversation_id: str):
"node_results": conversation.node_results,
"active_node": active_node,
"workspace_summary": workspace_summary,
"conversation_context": conversation_context,
"prompt_templates": prompt_templates,
"upload_form": upload_form,
"export_card": export_card,
"risk_card": risk_card,
@@ -246,6 +250,30 @@ def _build_workspace_summary(conversation: Conversation, batch: SubmissionBatch
}
def _build_conversation_context(
conversation: Conversation,
batch: SubmissionBatch | None,
workspace_summary: dict,
) -> dict:
return {
"batch_id": conversation.batch_id,
"product_name": conversation.product_name,
"workflow_type": batch.workflow_type if batch else "registration",
"task_status": conversation.task_status,
"highest_risk_level": workspace_summary.get("highest_risk_level", "-"),
"export_allowed": workspace_summary.get("export_allowed", "-"),
}
def _build_prompt_templates() -> list[str]:
return [
"请汇总当前资料包的章节点、页数和目录覆盖情况",
"请检查当前资料包缺失了哪些必交项和错放项",
"请抽取当前资料包的核心字段并标记低置信度项",
"请给出当前资料包的高风险项、责任人和整改建议",
]
def _build_export_card(result: AgentResult | None, conversation: Conversation) -> dict:
"""
统一组装 Word 导出能力卡上下文。