Phase P~S 전체 작업물: 검증 스크립트, 블록 템플릿, 설계 문서, 코드 수정
포함 내용: - Phase P/Q/R/S 설계 문서 (IMPROVEMENT-PHASE-*.md) - 영역별 검증 스크립트 (scripts/verify_*.py, test_*.py) - 블록 템플릿 추가 (cards, emphasis 변형) - 코드 수정: block_search, content_editor, design_director, slide_measurer - catalog.yaml 블록 목록 업데이트 - CLAUDE.md, PROGRESS.md, README.md 업데이트 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
129
scripts/verify_core_v5.py
Normal file
129
scripts/verify_core_v5.py
Normal file
@@ -0,0 +1,129 @@
|
||||
"""검증 B v5: 텍스트 왼쪽 | dx1.png 이미지 오른쪽.
|
||||
|
||||
참고 이미지(스크린샷) 구조 정확히 반영.
|
||||
dx1.png를 base64로 인라인 삽입하여 확실히 표시.
|
||||
"""
|
||||
from __future__ import annotations
|
||||
import asyncio, sys, time, datetime, base64, re
|
||||
from pathlib import Path
|
||||
|
||||
ROOT = Path(__file__).parent.parent
|
||||
sys.path.insert(0, str(ROOT))
|
||||
|
||||
|
||||
async def main():
|
||||
from src.slide_measurer import capture_slide_screenshot
|
||||
from src.config import settings
|
||||
import anthropic
|
||||
|
||||
out_dir = ROOT / "data" / "runs" / f"verify_core_v5_{datetime.datetime.now().strftime('%Y%m%d_%H%M%S')}"
|
||||
out_dir.mkdir(parents=True, exist_ok=True)
|
||||
|
||||
# dx1.png를 base64로 변환
|
||||
dx1_path = Path("D:/ad-hoc/cel/public/assets/images/dx1.png")
|
||||
dx1_b64 = ""
|
||||
if dx1_path.exists():
|
||||
dx1_b64 = base64.b64encode(dx1_path.read_bytes()).decode()
|
||||
|
||||
client = anthropic.AsyncAnthropic(api_key=settings.anthropic_api_key)
|
||||
t0 = time.time()
|
||||
|
||||
prompt = f"""다음 콘텐츠를 본심 영역 HTML로 만들어라. 707px × 293px.
|
||||
|
||||
## 레이아웃 (정확히 이 구조를 따르라)
|
||||
|
||||
왼쪽(55%): 텍스트 | 오른쪽(45%): 이미지
|
||||
|
||||
텍스트가 왼쪽, 이미지가 오른쪽이다. 반대로 하지 마라.
|
||||
|
||||
## 왼쪽 영역 (텍스트)
|
||||
|
||||
원본 텍스트를 그대로 사용:
|
||||
|
||||
"DX는 BIM, GIS, 디지털 트윈 등 핵심기술의 융합을 통해서만 실현 가능한 상위개념이다."
|
||||
|
||||
• GIS: 지리적 데이터를 공간 분석하여 시각적으로 표현, 위치기반 정보 제공
|
||||
• BIM: 시설물의 생애주기 동안 발생한 모든 정보를 3차원 모델 기반으로 통합·관리하는 정보 관리 도구
|
||||
• 디지털 트윈: 현실 세계의 물리적 객체나 시스템을 디지털 환경에 동일하게 구현하는 기술
|
||||
|
||||
"DX는 이들 기술을 통합하여 업무방식과 가치 창출 구조를 근본적으로 전환하는 과정 및 결과이다."
|
||||
|
||||
## 오른쪽 영역 (이미지)
|
||||
|
||||
이미지를 아래 태그로 삽입 (base64 인라인):
|
||||
<img src="data:image/png;base64,{dx1_b64}" style="width:100%; border-radius:8px; border:1px solid #e2e8f0;">
|
||||
|
||||
## 하단
|
||||
|
||||
오른쪽 상단에:
|
||||
<details><summary style="font-size:11px; color:#2563eb; cursor:pointer; font-weight:bold; text-align:right;">📊 DX vs BIM 상세 비교표</summary>
|
||||
표:
|
||||
| 기준 | DX | BIM |
|
||||
| 범위 | Engineering + Management 통합 | Only 3D (형상 구현 중심) |
|
||||
| 프로세스 | 근본적 문제의식을 통한 개선 | 기존 2D 설계 방식 유지 |
|
||||
| 활용 | 설계/시공 생산성 혁신 | 3D 모델에 의한 일반적 이해 향상 |
|
||||
| 확장성 | 전 생애주기 활용 시스템 | (설계/시공/운영) 분야별 단절 |
|
||||
</details>
|
||||
|
||||
맨 아래에 핵심 메시지:
|
||||
background: #f0f9ff, border: 2px solid #bae6fd, border-radius: 8px, padding: 8px, text-align: center
|
||||
"BIM ≠ DX — BIM은 DX를 실현하기 위한 핵심 기술 중 하나일 뿐이다"
|
||||
"BIM ≠ DX": color: #dc2626, font-weight: 900
|
||||
|
||||
## 디자인
|
||||
- flex로 가로 배치 (왼쪽 텍스트 55%, 오른쪽 이미지 45%)
|
||||
- 왼쪽 텍스트: 12px #1e293b, 불릿 11px #475569
|
||||
- 기술명(GIS, BIM, 디지털 트윈): bold
|
||||
- 전체 293px 안에 맞출 것
|
||||
- "상위개념", "하위기술" 단어 사용 금지
|
||||
|
||||
HTML + inline <style>만 반환. 설명 없이 코드만."""
|
||||
|
||||
print("=== 검증 B v5: 텍스트 왼쪽 | 이미지 오른쪽 ===")
|
||||
|
||||
try:
|
||||
response = await client.messages.create(
|
||||
model="claude-sonnet-4-20250514",
|
||||
max_tokens=16384,
|
||||
messages=[{"role": "user", "content": prompt}],
|
||||
)
|
||||
text = response.content[0].text if response.content else ""
|
||||
match = re.search(r"```html\s*(.*?)```", text, re.DOTALL)
|
||||
html = match.group(1).strip() if match else text.strip()
|
||||
|
||||
wrapped = f"""<!DOCTYPE html>
|
||||
<html lang="ko"><head><meta charset="UTF-8">
|
||||
<style>
|
||||
@import url('https://cdn.jsdelivr.net/gh/orioncactus/pretendard@v1.3.9/dist/web/variable/pretendardvariable-dynamic-subset.min.css');
|
||||
* {{ margin: 0; padding: 0; box-sizing: border-box; }}
|
||||
.slide {{
|
||||
width: 1280px; height: 720px; overflow: hidden; background: white;
|
||||
font-family: 'Pretendard Variable', sans-serif;
|
||||
display: flex; align-items: center; justify-content: center;
|
||||
}}
|
||||
.test-container {{ width: 707px; }}
|
||||
</style>
|
||||
</head><body>
|
||||
<div class="slide"><div class="test-container">
|
||||
{html}
|
||||
</div></div>
|
||||
</body></html>"""
|
||||
|
||||
(out_dir / "B_core_v5.html").write_text(wrapped, encoding="utf-8")
|
||||
s = await asyncio.to_thread(capture_slide_screenshot, wrapped)
|
||||
if s:
|
||||
(out_dir / "B_core_v5.png").write_bytes(base64.b64decode(s))
|
||||
print(f" [{time.time()-t0:.0f}s] 완료")
|
||||
print(f" 결과: {out_dir}")
|
||||
|
||||
except Exception as e:
|
||||
print(f" 오류: {e}")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
import logging
|
||||
logging.basicConfig(level=logging.INFO, format="%(asctime)s %(levelname)s %(message)s", datefmt="%H:%M:%S")
|
||||
logging.getLogger("selenium").setLevel(logging.WARNING)
|
||||
logging.getLogger("urllib3").setLevel(logging.WARNING)
|
||||
logging.getLogger("httpx").setLevel(logging.WARNING)
|
||||
asyncio.run(main())
|
||||
Reference in New Issue
Block a user