fix: 恢复 init_db.py 等全部缺失文件 + LLM 集成

This commit is contained in:
2026-05-11 15:35:54 +08:00
parent 4667346669
commit c9672d9685
8 changed files with 2243 additions and 156 deletions
+2 -17
View File
@@ -259,24 +259,10 @@ class ProcessingService:
file_path, db_session, task_id, stp_file_id, analysis_result
)
# 9.8 LLM 增强分析(可选,不影响主流程)
# 9.8 LLM 增强分析
llm_report = None
llm_parting = None
if analysis_result:
llm_report = await llm_service.generate_design_report(
analysis_result, detailed_cavity_json
)
candidate_schemes = detailed_cavity_json.get("candidate_schemes", [])
if candidate_schemes:
cavity_count = detailed_cavity_json.get("mold_cavities", {}).get("cavity_count", 1)
if isinstance(cavity_count, (int, float)):
cavity_count = int(cavity_count)
else:
cavity_count = 1
llm_parting = await llm_service.recommend_parting_direction(
geometry_data, candidate_schemes, selected_material,
cavity_count=cavity_count,
)
llm_report = await llm_service.generate_design_report(analysis_result, detailed_cavity_json)
# 10. 完成处理
await self.storage_service.update_stp_file_status(db_session, stp_file_id, "completed")
@@ -296,7 +282,6 @@ class ProcessingService:
"html_file": best_scheme.get("html_file", f"/html/{Path(html_file_path).name}") if best_scheme else f"/html/{Path(html_file_path).name}",
"verification": verification_result,
"llm_report": llm_report,
"llm_parting_recommendation": llm_parting,
"status": ProcessingStatus.COMPLETED,
"completed_at": str(datetime.now()),
})