Prepare AI-ready 1C structure packages
CI / python (push) Has been cancelled
CI / rust (push) Has been cancelled

This commit is contained in:
2026-05-21 20:43:14 +03:00
parent 5f066d2f6b
commit e86f6be385
7 changed files with 475 additions and 0 deletions
@@ -0,0 +1,35 @@
from __future__ import annotations
from collections.abc import Callable, Iterable
from pathlib import Path
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_forms import form_value
def html5_ai_structure_page(
*,
project_id: str,
project_summaries: Callable[[], Iterable[object]],
) -> str:
return render_html5_ai_structure_page(project_id=project_id, projects=project_summaries())
def html5_ai_structure_run(
*,
project_id: str,
form: dict[str, list[str]],
prepare: Callable[..., dict[str, Any]],
) -> str:
effective_project_id = form_value(form, "project_id") or project_id
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")
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_result(result)