22 lines
823 B
Python
22 lines
823 B
Python
"""스타일링 ② — 레퍼런스 화풍 분석 응답 스키마
|
|
|
|
무드 형용사는 픽셀로 번역되지 않아 팔레트·조명·질감·타이포·구도 다섯을 요구한다.
|
|
짧게 나오면 다섯 중 빠진 것이 있다는 뜻이라 통과시키지 않는다.
|
|
"""
|
|
from pydantic import BaseModel, field_validator
|
|
|
|
MIN_STYLE_PROMPT_CHARS = 200
|
|
|
|
|
|
class StylePromptAnswer(BaseModel):
|
|
style_prompt: str
|
|
|
|
@field_validator("style_prompt")
|
|
@classmethod
|
|
def must_cover_five_elements(cls, style_prompt: str) -> str:
|
|
text = style_prompt.strip()
|
|
if len(text) < MIN_STYLE_PROMPT_CHARS:
|
|
raise ValueError(f"style_prompt가 {len(text)}자로 너무 짧음 "
|
|
f"({MIN_STYLE_PROMPT_CHARS}자 이상) — 5요소가 다 안 나옴")
|
|
return text
|