Add Type B slide pipeline and recipe rendering updates

This commit is contained in:
2026-04-15 16:39:50 +09:00
parent 51548fdc41
commit 66c00924ed
22 changed files with 6260 additions and 1322 deletions

View File

@@ -23,12 +23,30 @@ from pydantic import BaseModel, Field, model_validator
# 하위 모델
# ──────────────────────────────────────
class PopupItem(BaseModel):
"""팝업/첨부 항목.
생애주기:
Stage 0 → title, content 확정
Y-14 감지 → popup_id 확정, is_component, source
Stage 2 → popup_id로 참조 (popup_file은 아직 없음)
Stage 5 저장 → popup_file 확정 (run_dir + 파일명 정책)
"""
popup_id: str = "" # 감지 시점에 확정 (예: "popup_1", "comp_DxEffect")
title: str = ""
content: str = ""
source: str | None = None
is_component: bool = False
target_role: str | None = None # Y-14에서 확정: 이 popup이 속하는 role 이름
popup_file: str | None = None # Stage 5에서 확정
class NormalizedContent(BaseModel):
"""Stage 0 출력: MDX 정규화 결과."""
clean_text: str = ""
title: str = ""
images: list[dict[str, str]] = Field(default_factory=list)
popups: list[dict[str, str]] = Field(default_factory=list)
popups: list[PopupItem] = Field(default_factory=list)
tables: list[dict[str, Any]] = Field(default_factory=list)
sections: list[dict[str, Any]] = Field(default_factory=list)
@@ -61,6 +79,7 @@ class PageStructure(BaseModel):
class Analysis(BaseModel):
"""Stage 1A 출력: Kei 분석 결과 전체."""
core_message: str = ""
conclusion_text: str = "" # Phase Y: slide-base footer에 들어갈 핵심요약 원본 텍스트
title: str = ""
total_pages: int = 1
layout_template: str = "A" # Phase X-B: Kei가 선택한 유형 (A 또는 B)
@@ -166,6 +185,9 @@ class PipelineContext(BaseModel):
topics: list[Topic] = Field(default_factory=list)
page_structure: PageStructure = Field(default_factory=PageStructure)
# ── Phase Y: MDX 원본 섹션 (## 파싱 결과) ──
mdx_sections: list[dict[str, Any]] = Field(default_factory=list) # [{title, content, level, is_intro}]
# ── Stage 1.5a ──
font_hierarchy: FontHierarchy = Field(default_factory=FontHierarchy)
container_ratio: tuple[int, int] = (0, 0) # Stage 1.5a에서 설정 (body_pct, sidebar_pct)
@@ -178,6 +200,7 @@ class PipelineContext(BaseModel):
# ── Stage 1.8 ──
fit_result: dict[str, Any] = Field(default_factory=dict)
font_scale: float = 1.0 # Phase Y: fit 루프에서 확정된 font 축소 비율
enhancement_result: dict[str, Any] = Field(default_factory=dict)
sub_layouts: dict[str, Any] = Field(default_factory=dict) # role → ContainerLayout 직렬화