diff --git a/backend/app/api/v1/concepts.py b/backend/app/api/v1/concepts.py index b33f138c..579212b3 100644 --- a/backend/app/api/v1/concepts.py +++ b/backend/app/api/v1/concepts.py @@ -1,6 +1,7 @@ import logging from fastapi import APIRouter, HTTPException +from fastapi.concurrency import run_in_threadpool from app.schemas.concept import ConceptInput, ConceptOutput from app.services.generative import geometry @@ -23,7 +24,9 @@ async def create_concept(payload: ConceptInput) -> ConceptOutput: 422 rather than empty variants — that is a bad request, not a valid empty result. """ try: - variants = geometry.generate(payload) + # geometry.generate — синхронный CPU-bound (Shapely/STRtree), мостим через + # run_in_threadpool, чтобы НЕ блокировать event loop (тот же приём, что и в chat.py). + variants = await run_in_threadpool(geometry.generate, payload) except ParcelGeometryError as exc: logger.warning("concept generation rejected parcel: %s", exc) raise HTTPException(status_code=422, detail=str(exc)) from exc diff --git a/frontend/src/components/site-finder/entry/EntryMap.tsx b/frontend/src/components/site-finder/entry/EntryMap.tsx index 95830385..6fabb71c 100644 --- a/frontend/src/components/site-finder/entry/EntryMap.tsx +++ b/frontend/src/components/site-finder/entry/EntryMap.tsx @@ -106,7 +106,7 @@ function ParcelMarkers({
{parcel.cad_num}
- {parcel.area_ha.toFixed(2)} га · {statusLabel} + {parcel.area_ha != null ? parcel.area_ha.toFixed(2) : "—"} га · {statusLabel}
Нажмите, чтобы открыть анализ @@ -129,7 +129,7 @@ function ParcelMarkers({
- {parcel.area_ha.toFixed(2)} га · {statusLabel} + {parcel.area_ha != null ? parcel.area_ha.toFixed(2) : "—"} га · {statusLabel}