diff --git a/api/insurance/ppt/routes.py b/api/insurance/ppt/routes.py index 8dda41e..56b796b 100644 --- a/api/insurance/ppt/routes.py +++ b/api/insurance/ppt/routes.py @@ -138,6 +138,7 @@ def parse_session(session_id): result = asyncio.run(orchestrator.extract_plan(filepath, plan_type)) extractions.append({ "pdfName": file_info.get("name", ""), + "pdfPath": filepath, "planType": result.plan_type, "status": result.status, "productName": result.product_name, @@ -149,6 +150,7 @@ def parse_session(session_id): logger.error(f"PDF 解析失败 [{file_info.get('name', '')}]: {e}", exc_info=True) extractions.append({ "pdfName": file_info.get("name", ""), + "pdfPath": filepath, "planType": plan_type, "status": "error", "productName": "unknown", @@ -275,9 +277,11 @@ def generate_ppt(session_id): # 取第一个成功的提取结果 ext_data = None + pdf_path = None for ext in extractions: if ext.get("status") in ("success", "cached") and ext.get("data"): ext_data = ext["data"] + pdf_path = ext.get("pdfPath") break if not ext_data: @@ -289,13 +293,13 @@ def generate_ppt(session_id): plan_type = ext_data.get("product_type", "savings") if plan_type == "ci": - normalized = normalize_ci_plan(ext_data) + normalized = normalize_ci_plan(ext_data, pdf_path) issues = validate_formal_ci_plan(normalized) elif plan_type == "iul": - normalized = normalize_iul_plan(ext_data) + normalized = normalize_iul_plan(ext_data, pdf_path) issues = validate_formal_iul_plan(normalized) else: - normalized = normalize_savings_plan(ext_data) + normalized = normalize_savings_plan(ext_data, pdf_path) issues = validate_formal_savings_plan(normalized) # 检查是否有阻断性错误