Show AI structure path errors in HTML5
CI / python (push) Has been cancelled
CI / rust (push) Has been cancelled

This commit is contained in:
2026-05-21 23:31:01 +03:00
parent dafb552ad3
commit 9ea2ff5518
3 changed files with 47 additions and 7 deletions
@@ -6,7 +6,11 @@ from typing import Any
from fastapi import HTTPException
from api_server.html5_ai_structure import render_html5_ai_structure_page, render_html5_ai_structure_result
from api_server.html5_ai_structure import (
render_html5_ai_structure_error,
render_html5_ai_structure_page,
render_html5_ai_structure_result,
)
from api_server.html5_forms import form_value
@@ -28,8 +32,15 @@ def html5_ai_structure_run(
input_path = form_value(form, "input_path")
output_path = form_value(form, "output_path")
if not input_path:
raise HTTPException(status_code=400, detail="input_path is required")
return render_html5_ai_structure_error("Заполните входную папку с .cf/.cfe или выгрузкой 1С.")
if not output_path:
raise HTTPException(status_code=400, detail="output_path is required")
result = prepare(project_id=effective_project_id, input_path=Path(input_path), output_path=Path(output_path))
return render_html5_ai_structure_error("Заполните папку результата.")
try:
result = prepare(project_id=effective_project_id, input_path=Path(input_path), output_path=Path(output_path))
except FileNotFoundError as error:
return render_html5_ai_structure_error(str(error))
except PermissionError as error:
return render_html5_ai_structure_error(f"Нет доступа к папке: {error}")
except OSError as error:
return render_html5_ai_structure_error(f"Ошибка файловой системы: {error}")
return render_html5_ai_structure_result(result)