diff --git a/src/api/routes.py b/src/api/routes.py index 9cac3f1..b1f3c25 100644 --- a/src/api/routes.py +++ b/src/api/routes.py @@ -110,7 +110,9 @@ async def get_status(task_id: str, db_session: AsyncSession = Depends(get_db_ses # 1. 内存任务(进行中的任务) if task_id in tasks: task = tasks[task_id] - logger.info(f"返回内存任务状态:{task_id} - {task['status']} - geometry_data: {task.get('geometry_data', 'None')}") + logger.info(f"返回内存任务状态:{task_id} - {task['status']}") + logger.info(f"内存任务 analysis_result: {task.get('analysis_result', 'None')}") + logger.info(f"内存任务 html_file: {task.get('html_file', 'None')}") return task # 2. 持久化任务(已完成/失败,或服务重启后的任务) @@ -691,6 +693,7 @@ async def process_file_core( tasks[task_id]["analysis_result"] = analysis_result tasks[task_id]["cavity_data"] = detailed_cavity_json tasks[task_id]["key_info"] = detailed_cavity_json # 传递完整数据给前端 + tasks[task_id]["html_file"] = f"/html/{Path(html_file_path).name}" # 只使用文件名 tasks[task_id]["status"] = ProcessingStatus.COMPLETED tasks[task_id]["completed_at"] = str(datetime.now()) diff --git a/src/main.py b/src/main.py index 01e9a64..fa597a7 100644 --- a/src/main.py +++ b/src/main.py @@ -96,6 +96,10 @@ import os static_dir = os.path.join(os.getcwd(), "static") app.mount("/static", StaticFiles(directory=static_dir), name="static") +# 挂载HTML输出目录 +html_output_dir = os.path.join(os.getcwd(), "html_output") +app.mount("/html", StaticFiles(directory=html_output_dir), name="html") + app.include_router(auth_router) app.include_router(inventory_router) app.include_router(router, prefix="/api") diff --git a/static/vue-app.js b/static/vue-app.js index ffbe3ca..8ab552c 100644 --- a/static/vue-app.js +++ b/static/vue-app.js @@ -1127,10 +1127,10 @@ const ResultView = {
整体轮廓和尺寸比例 - {{ state.task.analysis_result?.geometry_data?.bounding_box ? - (state.task.analysis_result.geometry_data.bounding_box.x?.toFixed(1) || 0) + ' × ' + - (state.task.analysis_result.geometry_data.bounding_box.y?.toFixed(1) || 0) + ' × ' + - (state.task.analysis_result.geometry_data.bounding_box.z?.toFixed(1) || 0) + ' mm' : 'N/A' }} + {{ state.task.analysis_result?.geometry_data?.bounding_box?.dimensions ? + (state.task.analysis_result.geometry_data.bounding_box.dimensions[0]?.toFixed(1) || 0) + ' × ' + + (state.task.analysis_result.geometry_data.bounding_box.dimensions[1]?.toFixed(1) || 0) + ' × ' + + (state.task.analysis_result.geometry_data.bounding_box.dimensions[2]?.toFixed(1) || 0) + ' mm' : 'N/A' }}
壁厚分布