feat: add real PDF ingestion workflow

This commit is contained in:
Codex
2026-08-02 00:29:40 +08:00
parent 0eb2a86f36
commit 4d97a30616
18 changed files with 986 additions and 93 deletions
+9
View File
@@ -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)
+7 -1
View File
@@ -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)