13 lines
745 B
Python
13 lines
745 B
Python
from __future__ import annotations
|
||
|
||
|
||
def build_assistant_summary(*, batch_no: str, exports: list[dict], failed_files: list[dict]) -> str:
|
||
zip_exports = [item for item in exports if item.get("export_type") == "zip" or str(item.get("file_name", "")).endswith(".zip")]
|
||
other_exports = [item for item in exports if item not in zip_exports]
|
||
lines = [f"已完成第1章监管信息材料包生成,批次号:{batch_no}。", ""]
|
||
for export in [*zip_exports, *other_exports]:
|
||
lines.append(f"- [{export['file_name']}]({export['download_url']})")
|
||
for failed in failed_files:
|
||
lines.append(f"- {failed.get('file_name')}:生成失败,{failed.get('error_message') or '原因待查看'}")
|
||
return "\n".join(lines)
|