[feat] solution/backend: 수집 뒤 콘텐츠 채울 때 캐치프레이즈·순환 문구 생성 — 숙박만
가게별 첫 화면 문구를 만드는 곳이 없어 모든 숙박이 공통 문구 10개를 돌려 썼다. - COPY 잡에 catchphrase 단계(prepare→generate→save→catchphrase→faq_fill), 숙박이 아니면 건너뜀 - prompts/catchphrase.py·gemini_text.generate_catchphrases: 캐치프레이즈 1 + 일반 20·계절 3×4·월 12·날씨 2×4. 문구마다 길이·상호명·ground_check(근거 없는 시설·수치) 검사 - fact tagline·catchphrases(lodging 스키마, allow_llm). 순환 문구는 사장님이 줄 단위로 고치게 글로 저장 (catchphrase_text: `봄 | ` · `9월 | ` · `비 | ` 머리) - site_payload: narrative.tagline·catchphrases 로 넘기고 이용정보 표(facts)에서는 뺀다 - 빌더 생성 화면 단계 문구, DATA_MODEL·GENERATION_FLOW 테스트 6건 추가. 관련 20개 파일 386 passed · 실패 102건은 main 과 목록이 같다(기존 실패) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
a0b14dfca1
commit
ef0c44c5f2
13 files changed
+377
-8
No files matched your search
@@ -377,3 +377,34 @@ async def test_summarize_empty_text_returns_none():
|
||||
"""검증: 빈 문자열."""
|
||||
result = await gt.summarize_text(" ")
|
||||
assert result is None
|
||||
|
||||
|
||||
# ── 첫 화면 문구 ───────────────────────────────────────────────────────────
|
||||
def _phrase_payload(body):
|
||||
return {
|
||||
"candidates": [{"content": {"parts": [{"text": json.dumps(body, ensure_ascii=False)}]}, "finishReason": "STOP"}],
|
||||
"usageMetadata": {"promptTokenCount": 800, "candidatesTokenCount": 400},
|
||||
}
|
||||
|
||||
|
||||
async def test_catchphrases_keep_only_grounded_lines_of_the_right_shape():
|
||||
body = {
|
||||
"tagline": "주차하고 바로 쉬는 집",
|
||||
"general": ["짐을 풀면 골목부터 걸어 보세요", "오션뷰 수영장이 있습니다", "짧다", "하조대펜션에서 쉬세요"],
|
||||
"season": [{"season": "봄", "text": "봄에는 창을 열어 둡니다"}, {"season": "장마", "text": "비가 오래 오는 계절입니다"}],
|
||||
"month": [{"month": 1, "text": "새해 첫 아침을 조용히"}, {"month": 13, "text": "없는 달의 문구입니다"}],
|
||||
"weather": [{"weather": "비", "text": "빗소리를 들으며 쉬세요"}],
|
||||
}
|
||||
async with _client(_ok(_phrase_payload(body))) as c:
|
||||
res = await gt.generate_catchphrases("하조대펜션", FACTS, client=c)
|
||||
assert res.tagline == "주차하고 바로 쉬는 집"
|
||||
assert res.items == [
|
||||
{"text": "짐을 풀면 골목부터 걸어 보세요", "kind": "general"},
|
||||
{"text": "봄에는 창을 열어 둡니다", "kind": "season", "season": "봄"},
|
||||
{"text": "새해 첫 아침을 조용히", "kind": "month", "month": 1},
|
||||
{"text": "빗소리를 들으며 쉬세요", "kind": "weather", "weather": "비"},
|
||||
]
|
||||
reasons = dict(res.rejected)
|
||||
assert "오션뷰 수영장이 있습니다" in reasons
|
||||
assert reasons["짧다"].startswith("길이")
|
||||
assert reasons["하조대펜션에서 쉬세요"] == "상호명 포함"
|
||||
Reference in new issue
Block a user