feat: 持久化资料包导出记录与列表摘要

This commit is contained in:
2026-06-04 02:41:49 +08:00
parent 0e49466746
commit ab3d520642
9 changed files with 250 additions and 8 deletions

View File

@@ -8,6 +8,7 @@ import zipfile
from django.conf import settings
from agent_core.governance import load_governance_config
from apps.documents.services import create_export_record
def generate_registration_export(*, batch, conversation, upstream_summary: dict | None = None) -> dict:
@@ -48,7 +49,7 @@ def generate_registration_export(*, batch, conversation, upstream_summary: dict
if can_export_formally
else "已生成草稿导出文件,正式版仍被风险项阻断。"
)
return {
report = {
"output_type": "registration_word_export_report",
"summary": summary,
"template_name": template_mapping["template_name"],
@@ -72,6 +73,19 @@ def generate_registration_export(*, batch, conversation, upstream_summary: dict
"export_mode": export_mode,
},
}
create_export_record(
batch=batch,
conversation_id=conversation.conversation_id,
product_name=batch.product_name or conversation.product_name,
template_name=report["template_name"],
template_version=report["template_version"],
export_mode=export_mode,
output_type=report["output_type"],
file_name=file_name,
relative_path=relative_path.as_posix(),
download_url=download_url,
)
return report
def update_conversation_with_export_report(conversation, export_report: dict) -> None: