feat: add real PDF ingestion workflow
This commit is contained in:
@@ -50,6 +50,7 @@ class PlanLayer(BaseModel):
|
||||
category: str
|
||||
visible: bool = True
|
||||
source_names: list[str] = Field(default_factory=list)
|
||||
element_count: int | None = None
|
||||
|
||||
|
||||
class PlanIssue(BaseModel):
|
||||
@@ -63,9 +64,17 @@ class PlanIssue(BaseModel):
|
||||
class PlanState(BaseModel):
|
||||
source_name: str
|
||||
source_kind: str
|
||||
source_object_key: str | None = None
|
||||
preview_object_key: str | None = None
|
||||
preview_width: int | None = None
|
||||
preview_height: int | None = None
|
||||
page_count: int = 1
|
||||
vector_based: bool = False
|
||||
vector_element_count: int = 0
|
||||
cad_layer_count: int = 0
|
||||
ocr_used: bool = False
|
||||
ocr_labels: list[str] = Field(default_factory=list)
|
||||
ingestion_notes: list[str] = Field(default_factory=list)
|
||||
regions: list[PlanRegion] = Field(default_factory=list)
|
||||
selected_region_id: str | None = None
|
||||
layers: list[PlanLayer] = Field(default_factory=list)
|
||||
|
||||
@@ -80,7 +80,13 @@ def apply_command(project: ProjectSnapshot, request: CommandRequest) -> ProjectS
|
||||
updated.failure_reason = None
|
||||
|
||||
if request.command == WorkflowCommand.SELECT_REGION:
|
||||
updated.plan.selected_region_id = request.payload.get("region_id")
|
||||
region_id = str(request.payload.get("region_id", ""))
|
||||
if not any(region.id == region_id for region in updated.plan.regions):
|
||||
raise InvalidTransitionError(f"Region '{region_id}' does not exist in this project.")
|
||||
updated.plan.selected_region_id = region_id
|
||||
for issue in updated.plan.issues:
|
||||
if issue.kind == "region":
|
||||
issue.resolved = True
|
||||
elif request.command == WorkflowCommand.CONFIRM_PLAN:
|
||||
updated.plan.ceiling_height_mm = int(
|
||||
request.payload.get("ceiling_height_mm", updated.plan.ceiling_height_mm)
|
||||
|
||||
Reference in New Issue
Block a user