Compare commits

..
Author SHA1 Message Date
minaChoiandClaude Opus 5.5 c0f361b831 merge: chore/pretendard-font(Pretendard 폰트 파일) 을 main 에 병합
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-01 15:15:51 +09:00
minaChoiandClaude Opus 5.5 1b82b727c2 [fix] solution/frontend,site: Pretendard 폰트 파일 추가 — 처음부터 없어 모든 환경에서 404
base.css 의 @font-face 가 /fonts/PretendardVariable.woff2 를 가리키는데 public/fonts 에는 README 만 있었다.
킹서버 실측: 그 주소가 404 — 윈도우 콘솔에 폰트 오류로 보였고, 빌더와 Pretendard 를 쓰는
기본 템플릿은 맥·윈도우 모두 Noto Sans KR 로 떨어져 있었다. Pretendard 는 구글 폰트에 없다.

- public/fonts/PretendardVariable.woff2 (v1.3.9 가변, 2.0MB, orioncactus/pretendard 공식 배포본,
  sha256 9599f12f…) — 빌더(frontend)·발행본(site) 양쪽
- Pretendard-OFL.txt: SIL OFL 1.1 은 폰트 배포 시 라이선스 동봉을 요구한다

vite build 산출물에 fonts/ 포함 확인

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-01 15:12:03 +09:00
HyeongBaeYangandClaude Opus 5.5 c7749662fd merge: origin/main 을 main 에 병합 — 온톨로지 배포 전 동기화
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-01 15:05:25 +09:00
HyeongBaeYangandClaude Opus 5.5 3538e2dbc9 [fix] ontology: 임베딩 모델을 볼륨에 남김 — transformers.js 4.x 가 TRANSFORMERS_CACHE 를 무시
컨테이너를 새로 만들 때마다 모델 465MB 를 다시 받았다(실측 2분 49초). 그 사이 첫 발행은
publish 60초 상한을 넘겨 키워드 없이 나간다. 4.x 는 이 변수를 읽지 않고 node_modules 아래에
받아서 ontology-model 볼륨(/app/.cache)이 비어 있었다.

- config/env: embedding.cacheDir ← TRANSFORMERS_CACHE
- local.provider: transformers.js env.cacheDir 로 넘김

tsc 통과. 로컬 compose: 재생성 후 /app/.cache 465M, 다시 재생성하면 모델 로딩 1.7초

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-01 15:05:16 +09:00
minaChoiandClaude Opus 5.5 ef6f2a1068 merge: fix/cards-hero-weather(사진 카드·가운데 창·첫 화면 캐치프레이즈·날씨 HTML 제외) 을 main 에 병합
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-01 14:51:30 +09:00
HyeongBaeYangandClaude Opus 5.5 f32edfeaa1 merge: feature/ontology-llm-keywords(온톨로지 OpenAI 키워드 생성 · 호텔 업종 · 숙소 검색) 을 main 에 병합
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-01 14:37:24 +09:00
minaChoiandClaude Opus 5.5 e33bee7e33 [fix] solution/site: 날씨를 HTML 에 굽지 않음 — 발행 시점 날씨가 박히고 매번 하이드레이션 실패
발행본 HTML 에 그 순간 기온·관측 시각이 박혀 구글과 첫 화면이 며칠 전 날씨를 봤다.
라운드·코랄·미니멀·솔숲은 관측 시각(시간대 없는 KST)을 new Date 로 읽어 굽는 서버(UTC)가
9시간 틀린 값을 박았고, 브라우저 값과 달라 열 때마다 React #418 → 페이지 전체를 다시 그렸다
(실측 /s/joyyy: HTML "22:45 관측" ↔ 브라우저 "13:45 관측").

- lib/use-live-weather.ts: 첫 렌더는 날씨 없음, 하이드레이션 뒤 스냅샷 → 최신 값
- layouts/{round,coral,minimal,pine}/Weather.tsx: 관측 시각을 글자 그대로 읽는다(다른 템플릿과 같게)
- lib/format.ts formatKoreanDate: 한국 시간 기준 날짜 — UTC 서버가 0~9시 KST 발행에서 하루 전 날짜를 박던 것
- WeatherSection: 문구 고르는 부분을 weatherLineSources 로 떼어 테스트. HTML 에 날씨가 없음을 테스트로 고정

tsc·eslint 통과 · vitest 128 passed · TZ=UTC 로 구운 10개 사이트 #418 0건

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-01 14:33:18 +09:00
minaChoiandClaude Opus 5.5 ef0c44c5f2 [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>
2026-10-01 14:33:17 +09:00
minaChoiandClaude Opus 5.5 a0b14dfca1 [fix] solution/site,shared: 첫 화면을 목업 구조로 — 캐치프레이즈 하나 고정, 아래 줄 순환
/s/stay 목업은 캐치프레이즈(tagline) 한 줄이 고정이고 그 아래 줄에서 문구가 돈다
(2026-09-11 "메인 모토는 고정, 그 아래 변동되는 모토"). 템플릿은 큰 줄에 공통 문구 10개를
돌리고 있었고, 앞 커밋의 소문구는 "명소까지 거리" 로 목업과 달랐다.

- sections/HeroCatchphrase.tsx: HeroCatchphrase = tagline 고정(없으면 공통 문구 중 사이트별 하나),
  HeroRotator = narrative.catchphrases 를 일반→계절→일반→월→일반→날씨 순서로 6초마다, 줄 높이는 가장 긴 문구
- 9종 Hero: 소문구 자리를 HeroRotator 로. kit/heroSub.ts 삭제
- shared: catchphrases 항목에 season·month·weather
- 테스트: 고정·폴백·비숙박·빈 순환·순서·날씨 분류

tsc·eslint 통과 · vitest 127 passed · 9종 모바일 캡처, 라운드·부티크 6초 간격 순환·높이 고정 확인

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-01 14:33:17 +09:00
minaChoiandClaude Opus 5.5 7a7f00dd15 [fix] solution/site: 첫 화면 태그 삭제·소문구 공통화 — 부티크 모바일도 문 모양
- 라운드·코랄·미니멀·솔숲: 히어로의 ‘주차 가능’ 칩 삭제. 일러스트: 지역 말풍선 삭제
- kit/heroSub.ts: 소문구 = 사장님 문구, 없으면 가장 가까운 명소까지 거리. 솔숲에만 있던 규칙을 9종 공통으로
- 고택·부티크: 캐치프레이즈 아래로 소문구 순서 변경
- 부티크 모바일: 전체화면 사진(664px)을 데스크톱과 같은 아치로 — 첫 화면 593px
- docs/TEMPLATE_DESIGN.md: 첫 화면 규칙

tsc·eslint 통과 · vitest 123 passed · 9종 모바일·1440px 첫 화면 캡처 확인

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-01 14:33:17 +09:00
minaChoiandClaude Opus 5.5 865eb0cc77 [fix] solution/site: 상세·예약 창을 화면 가운데로 — 모든 폭에서 바닥에 붙던 시트
9종이 함께 쓰는 Sheet 가 stay2 모바일 시안의 하단 시트를 그대로 옮긴 것이라
데스크톱에서도 640px 판이 화면 바닥에 붙어 떴다.

- kit.css·paper.css: .sheet 를 가운데 정렬, .sbox 폭 560px·높이 100svh-48px, 모서리는 템플릿 --k-r
- kit.css: 라운드·코랄·미니멀·솔숲 예약 창(.sheetbody)에 여백이 없어 글자가 창 끝에 붙던 것
- docs/TEMPLATE_DESIGN.md: 창 위치 규칙

eslint 통과 · vitest 123 passed · 9종 모바일·1440px 에서 위아래·좌우 여백 같음 확인

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-01 14:33:17 +09:00
minaChoiandClaude Opus 5.5 4831e2d25d [fix] solution/site: 사진 카드를 PhotoCard 하나로 통일 — 템플릿마다 제각각이던 축제·명소 카드
같은 템플릿 안에서도 축제 카드(흰 바탕·글 안쪽)와 명소 카드(바탕 없음·글 아래)가 따로 놀았다.
실측(9종 전수): 제목 굵기 400/500/700/900, 사진 모서리 0/12/18/22px 가 한 화면에 섞여 있었다.

- kit/Card.tsx·card.css: 사진 3:2 + 제목 1줄 + 거리 1줄 + 설명 2줄. 템플릿 차이는 --kc-* 변수만
- 9종 Around·Festival, 고택 인물: 사진 카드를 PhotoCard 로 교체. 맛집·홈 목록 행은 그대로
- 템플릿 CSS: 모서리·글꼴·강조색 변수와 그리드 간격. 일러스트는 상자형, 빅타이포는 선 격자
- 모바일 캐러셀 화살표가 카드를 가려 1024px 미만에서 숨김
- docs/TEMPLATE_DESIGN.md: 사진 카드 규칙

tsc·eslint 통과 · vitest 123 passed · 12개 사이트 굽기 · 카드 모양 템플릿당 1종 확인

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-01 14:33:17 +09:00
HyeongBaeYangandClaude Opus 5.5 94c4116689 [feat] solution/backend: 발행 때 온톨로지 키워드 생성을 켠다 — 호텔 판정 · 업종별 유형어 게이트
generate:false 로 불러 새 숙소가 사전 밖 단어를 받지 못했다. 생성을 켜면 호텔이 펜션 사전의
`군산 독채펜션` 을 받는데, 메타 게이트가 '펜션' 을 업종어로 보고 자료 없이 통과시켰다.

- site_ontology: generate+sync — 처음 보는 숙소만 저쪽이 기다리게 하고 publish 상한 60초
- seo_keywords: 외부 분류(없으면 상호)에 '호텔' 이면 stay.hotel, 자기 유형어만 자료 없이 통과
- snapshot: place.external_category 를 실음 — 호텔 판정 근거
- .env.example · ARCHITECTURE · DEVLOG: ONTOLOGY_LLM_PROVIDER, 발행 흐름, 실측

test_seo_keywords 20 passed(호텔 4건 추가). 전체 1041 passed / 47 failed —
47건은 이 변경 전 main 과 같은 목록

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-01 13:49:37 +09:00
HyeongBaeYangandClaude Opus 5.5 847943a8bc [feat] ontology: 새 숙소 키워드를 OpenAI 로 쌓고 매칭에 쓴다 — 호텔 업종 · 숙소 검색 정정
사전이 고정 데이터셋뿐이라 사전에 없는 숙소는 새 단어를 받지 못했고, 생성분은 MATCH_SOURCES 가
llm 을 빼서 만들어도 추천에 안 나왔다. 숙소 검색은 가까운 키워드를 사전 전체(7천)에서 뽑아
상위가 아무 숙소에도 안 붙은 단어로 차서 `선유도 독채` 가 0건이었다.

- merchants.controller: 처음 보는 업체·기한 지난 업체만 생성, sync 는 처음 보는 업체만 기다림 —
  재빌드마다 불리는 창구라 조건이 없으면 저장마다 요금. 동기 생성 실패는 200 + generation.failed
- generation·dedup·keyword.repository: mock 생성분은 source='mock' — compose 기본이 mock 이라
  키 없는 환경의 가짜 단어가 매칭 후보가 되지 않게
- match.service: llm 출처를 후보에 넣음(brand 는 그 업체 것만), 업종은 뿌리(stay)로 좁힘 —
  새 호텔은 호텔 사전이 비어 잎으로 좁히면 후보 0건
- openai.provider: 미확인 시설·다른 숙박 유형어·가격 주장 금지
- drizzle/0002 · seed: stay.hotel — 시드만 두면 떠 있는 DB 에서 외래키 위반 500
- serving.service: 숙소에 연결된 키워드만 비교, 검색어가 지역을 말하면 그 지역 숙소만 —
  e5-small 은 지역이 틀려도 0.85(`여수 호텔` → 군산 호텔 0.848)라 임계값으로는 못 가른다

tsc 통과. 로컬 :3101 + 실 OpenAI(가짜 숙소 2곳): 첫 발행 7초 · 키워드 12 생성 · 재발행 fresh,
검색 7건(`은파호수공원 근처 호텔`·`선유도 독채`·`군산시내호텔` 적중, `여수 호텔` 0건) 확인 후 테스트 데이터 삭제

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-01 13:49:37 +09:00
minaChoiandClaude Opus 5.5 089886fe1e merge: design/blog-card(미니블로그 일력 카드) 을 main 에 병합
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-01 11:42:04 +09:00
88 changed files with 1339 additions and 472 deletions

No files matched your search

+2
View File
@@ -47,6 +47,8 @@ SUNO_CALLBACK_URL=https://example.com/api/suno/callback
# ★ 워커가 부르는 주소다. compose 로 띄우면 컨테이너 안에서 보는 주소(http://host.docker.internal:3100),
# 백엔드를 네이티브로 돌리면 http://127.0.0.1:3100
SITE_ONTOLOGY_URL=
# 새 숙소 키워드를 OpenAI 로 만든다(OPENAI_API_KEY 를 함께 쓴다). mock 이면 생성분이 매칭에 나가지 않는다.
ONTOLOGY_LLM_PROVIDER=mock
# 프리렌더가 절대 굽지 않는 슬러그(쉼표 구분). 손으로 만든 목업(/s/stay·stay2·stay3·stay4·stay5)
# 이름과 같은 슬러그로 실제 발행이 생기면 그 payload 로 목업을 덮어 구워버린다 — 비우지 않는다.
+1 -1
View File
@@ -42,7 +42,7 @@ React 를 렌더해야 하고, 그때부터 디자인 수정에 백엔드 배포
BUILD 잡 (worker) ─ services/build_service.py:99 run_build()
├ build_snapshot → 원본 데이터(JSONB)
├ seo_keywords.fetch() → SiteOntology 추천을 이 가게 자료로 거른 키워드 → snapshot["seo"]
│ (숙박만 · 설정 없거나 실패하면 생략 · 발행은 계속)
│ (숙박만 · 처음 보는 숙소는 OpenAI 키워드 생성을 기다림 · 실패하면 생략 · 발행은 계속)
│ → site_versions 행 insert
├ 1차 게이트 (DB 사실 기준) → publish_gate.evaluate()
├ site_payload.emit_payload() → out/payloads/<slug>.json ★ 백엔드의 유일한 산출물
+1 -1
View File
@@ -276,7 +276,7 @@ COPY 단계는 `jobs.progress`(JSONB)의 `steps`·`attempt`에 기록한다.
|---|---|---|
| 1 COLLECT | `collect_service.run_collect` | 채널 발견 → 검증 → 크롤링 → fact·사진 적재 |
| 2 VISION | `vision_service.run_vision` | 사진 분류 + alt 생성 |
| 3 COPY | `copy_service.run_copy` | 소개문·FAQ (확보된 fact 만 근거) |
| 3 COPY | `copy_service.run_copy` | 소개문·FAQ · 숙박은 첫 화면 캐치프레이즈(fact `tagline`)와 순환 문구(fact `catchphrases`, 한 줄에 하나, `봄 \| ` · `9월 \| ` · `비 \| ` 머리) (확보된 fact 만 근거) |
| 4 BUILD | `build_service.run_build` | ★ 정적 빌드 + 발행 게이트 |
| 5 LOCAL_SYNC | `story_service.run_local_sync` | 지역 이야기 생성(지역당 1회) |
| 6 AI_CHECK | 미구현 | reports 모듈이 붙을 때 |
+22
View File
@@ -4,6 +4,28 @@
**나중에 같은 실수를 막아 주는 것**(결정의 이유·밟은 함정·실측값)만 남긴다.
2026-09-29에 요약본으로 다시 썼다. 원문 전체는 git 히스토리(이 파일의 09-29 이전 버전)에 있다.
## 2026-10-01 — 온톨로지: 새 숙소 키워드를 OpenAI 로 쌓는다 · 호텔 업종 · 숙소 검색
- 발행이 `generate:false` 로 불러 사전이 고정이었다 — 사전에 없는 숙소는 새 단어를 못 받았다.
이제 **처음 보는 숙소는 첫 발행에서 생성을 기다린다**(실측 7초, 키워드 15·질문 5). 재빌드·재발행은
30일 안이면 부르지 않는다 — 재빌드마다 부르는 창구라 조건이 없으면 저장마다 요금이 나간다.
- 생성분이 매칭에 안 나오던 이유는 `MATCH_SOURCES` 가 `llm` 을 뺀 것. 업종 뿌리(`stay`)로 거르고
brand 는 그 업체 것만 받게 해서 넣었다. **mock 생성분은 `source='mock'`** — compose 기본이 mock 이라
키 없이 띄운 환경마다 가짜 단어가 발행본에 나갈 뻔했다.
- 호텔(`stay.hotel`): 외부 분류(`places.external_category`, 없으면 상호)에 "호텔" 이면. 매칭은 펜션 사전도
받되 메타 게이트가 **자기 유형어만** 자료 없이 통과시킨다 — 호텔에 `군산 독채펜션` 이 붙지 않는다.
- `/v1/lodgings/search`: ★ 가까운 키워드를 사전 전체(7천)에서 뽑으면 상위가 아무 숙소에도 안 붙은
데이터셋 단어로 차서 `선유도 독채` 가 0건이었다 → **숙소에 연결된 키워드만** 비교한다.
★ e5-small 은 지역이 틀려도 0.85 가 나온다(`여수 호텔` → 군산 호텔 0.848) — 지역은 임계값이 아니라
**지역 이름**으로 가른다.
- ★ 로컬에서 임베딩 모델 내려받기가 Node 에서 `ECONNRESET`(terminated)으로 끊겨 3분 걸리고 실패했다.
curl 로는 받힌다. 실패한 로딩 promise 가 프로세스에 남아 **재시작 전까지 모든 임베딩이 500**이다.
- ★ 모델 캐시가 볼륨에 안 남았다 — transformers.js 4.x 는 `TRANSFORMERS_CACHE` 를 읽지 않고 node_modules 에
받는다. 컨테이너를 새로 만들 때마다 465MB 를 다시 받아 첫 발행이 60초 상한을 넘겼다 → `env.cacheDir`
로 직접 넘긴다. 재생성 후 모델 로딩 2분 49초 → 1.7초.
- 실키 검증(가짜 숙소 2곳): 메타에 `군산 시내 호텔`·`군산 오션뷰 호텔` 이 실렸고 미확인 `주차`·`애견동반`
은 안 나왔다. 백엔드 `1041 passed / 47 failed` — 47건은 이 변경 전 main 과 같은 목록.
## 2026-09-30 — 템플릿 검수 · 코랄 · 미니멀 · 솔숲 추가
- 한국 펜션 사이트(코랄트리 · 바다동화)를 참고해 `coral` · `minimal`, 디자인 스킬 시안에서 `pine`(솔숲).
+1 -1
View File
@@ -8,7 +8,7 @@
↓
새로고침 ──────────────────────→ GET /v1/job/{jobId}
↑
COPY 워커: prepare → generate → save → faq_fill
COPY 워커: prepare → generate → save → catchphrase(숙박만) → faq_fill
각 단계 진입·완료 → jobs.progress(JSONB)
↓
화면: 서버 단계 표시 → DONE일 때 데이터 갱신 → editor
+16
View File
@@ -49,6 +49,14 @@
- 같은 목록의 카드는 같은 크기: 사진은 고정 비율 + `object-fit:cover`, 글은 줄 수 말줄임
- 칸 수는 항목 수에 맞춘다(`repeat(auto-fit, minmax(…))`). 3개인데 4칸을 잡아 빈칸을 남기지 않는다
### 사진 카드는 하나다 — `layouts/kit/Card.tsx` `PhotoCard`
- 주변 안내 · 축제 · 명소 · 인물(사진 있을 때)은 모두 `PhotoCard` 를 쓴다. 템플릿마다 카드를 새로 짓지 않는다
- 모양: 사진(3:2) 아래에 제목 1줄 · 거리나 날짜 1줄 · 설명 2줄. 템플릿별로 다른 것은 `--kc-*` 변수만
(`--kc-r` 사진 모서리, `--kc-tf`·`--kc-tw` 제목 글꼴·굵기, `--kc-mc` 거리 색, 상자형은 `--kc-bg`·`--kc-box-r`)
- 사진 없는 목록(맛집 · 홈 가까운 곳 목록)은 행(row)으로 쓴다. 한 섹션 안에서 카드와 행을 섞지 않는다
- 모바일 캐러셀 화살표는 숨긴다(카드 위를 가린다). 1024px 이상에서만 사진 가운데 높이에 둔다
## 4. 섹션 머리
- **제목은 위, 내용은 아래.** 참고한 펜션 사이트들이 모두 이 방식이다
@@ -77,6 +85,13 @@
## 6. 값 보여주기
- **첫 화면은 캐치프레이즈 한 줄(고정) → 그 아래 순환 문구.** `/s/stay` 목업과 같다(`sections/HeroCatchphrase.tsx`)
- 캐치프레이즈 = `narrative.tagline`. 없으면 공통 문구 10개 중 사이트마다 정해진 하나
- 순환 = `narrative.catchphrases`, 일반 → 계절 → 일반 → 월 → 일반 → 날씨 순서, 6초. 없으면 줄을 두지 않는다
- 두 값은 COPY 잡이 소개문과 함께 만든다(fact `tagline` · `catchphrases`, `services/copy_steps.py`)
- 첫 화면에 태그·칩(‘주차 가능’, 지역 말풍선)을 두지 않는다
- 부티크 첫 화면은 모바일도 문(아치) 모양이다. 전체화면 사진으로 되돌리지 않는다
- **‘가능 · 있음’은 ✓, ‘불가 · 없음’은 ✕ 목록으로 쓴다.** `주차 / 가능` 같은 표로 쓰지 않는다
- 마크업: `<ul class="amen"><li class="on"><i class="ic">✓</i><span><b>주차</b> 가능</span></li>`
- 색: ✓ `#15803d`, ✕ `#c2410c`. 가능한 것을 먼저 놓는다
@@ -91,6 +106,7 @@
- 같은 동작은 한 이름: 예약 시트를 여는 버튼은 모두 **‘예약하기’**, 이용안내 탭으로 가는 버튼은 **‘이용안내 보기’**
- 버튼 글자가 두 줄로 접히면 안 된다. 모바일에서 버튼이 3개 이상이면 2열 격자로, 남는 하나는 한 줄 전체
- 키보드 포커스와 글자 선택색은 템플릿 색으로(`kit/kit.css`)
- 상세·예약 창(`paper/Sheet.tsx`)은 모든 폭에서 **화면 가운데** 뜬다. 폭 560px 이하, 모서리는 템플릿의 `--k-r`
## 8. 하지 않는 것
+7 -3
View File
@@ -2,7 +2,9 @@
o2o-site-AEO 가 발행한 사이트에 **업체별 SEO/AEO 키워드**를 제공하는 온톨로지 서비스.
- **고정 데이터셋 1회 적재** 정책 — 주기 수집 없음 (`data/gunsan-pension-keywords.json`, 1,000건)
- 사전은 **고정 데이터셋 + 업체별 LLM 생성분**이다. 처음 보는 숙소가 발행되면 OpenAI 로 키워드를 만들어
쌓고(`source='llm'`), 이후 매칭 후보가 된다. mock 이 만든 단어는 `source='mock'` 으로 남아 후보가 되지 않는다
- 업종은 숙박(`stay`) 아래 펜션(`stay.pension`)·호텔(`stay.hotel`). 매칭·검색은 뿌리(`stay`)로 묶는다
- 로컬 임베딩(`multilingual-e5-small`, 384차원)으로 pgvector 에 적재 후 의미 검색
- 업체명 또는 자연어 문장 → 사전에서 잘 맞는 키워드를 골라주는 **매칭 API + 데모 콘솔**
- 어휘 단계 중복제거는 자동, 벡터 근접쌍은 자동 병합하지 않고 검토 목록으로만
@@ -245,13 +247,14 @@ npm run dataset:ingest && npm run dataset:ingest-nationwide
| 메서드 | 경로 | 용도 |
|---|---|---|
| `GET` | `/health` | 헬스체크 |
| `POST` | `/v1/merchants/publish` | **사이트 발행 웹훅** — 업체 upsert + 생성 예약 (`sync:true` 면 동기 실행) |
| `POST` | `/v1/merchants/publish` | **사이트 발행 웹훅** — 업체 upsert + 생성. 처음 보는 업체·`REFRESH_INTERVAL_DAYS` 지난 업체만 생성하고, `sync:true` 는 처음 보는 업체에만 동기로 기다린다. 동기 생성이 실패해도 200 (`generation.failed`) |
| `POST` | `/v1/merchants/:id/generate?sync=true` | 수동 재생성 |
| `GET` | `/v1/merchants` `/v1/merchants/:id` | 조회 |
| `GET` | `/v1/sites/:id/seo?limit=20` | **발행 사이트가 렌더링 시 호출** — title/description/keywords/tags |
| `GET` | `/v1/sites/:id/aeo?limit=10` | 답변엔진용 topics/FAQ/structuredDataHints |
| `POST` | `/v1/match` | **업체명 또는 문장 → 사전에서 잘 맞는 키워드.** `mode=fusion`(기본) / `single`(통짜, 비교용) |
| `POST` | `/v1/keywords/search` | 의미 기반 키워드 검색 (어드민) |
| `POST` | `/v1/lodgings/search` | **검색어 → 맞는 숙소와 각 숙소의 SEO 메타.** 숙소에 연결된 키워드와의 유사도(≥0.87, 표기 변형은 aliases) + 지역 이름. 검색어가 지역을 말하면 그 지역 숙소만 |
| `GET` | `/demo` | 매칭 콘솔 (로컬 확인용) |
| `POST` | `/v1/sites/:id/performance` | Search Console·유입 로그 피드백 → 저성과 키워드 강등 |
@@ -401,7 +404,8 @@ curl -s -X POST http://localhost:3100/v1/match \
## 생성 주기
- **발행 즉시** — `/v1/merchants/publish` 가 BullMQ 에 적재 (60초 dedupe 창)
- **첫 발행** — 처음 보는 업체는 `/v1/merchants/publish` 가 동기로 생성한다 (o2o-site-AEO 가 `sync:true` 로 부른다)
- **기한 지난 업체의 발행** — BullMQ 에 적재 (60초 dedupe 창). 기한 안이면 생성하지 않는다(`generation: 'fresh'`)
- **주기 리프레시** — 매일 03:00 크론이 `REFRESH_INTERVAL_DAYS`(기본 30일) 지난 업체를 적재
- **성과 기반** — 노출 100회 이상 & CTR < 0.2% 인 키워드는 `demoted` 로 강등, 다음 사이클에서 대체
+4
View File
@@ -0,0 +1,4 @@
-- 호텔 업종. o2o-site-AEO 가 외부 분류에 "호텔" 이 있는 숙소를 stay.hotel 로 보낸다.
-- ★ 시드에만 두면 이미 떠 있는 DB 에는 없고, merchant.industry_id 외래키 위반으로 publish 가 500 이 된다.
INSERT INTO industry (id, path, name) VALUES ('stay.hotel', 'stay.hotel', '호텔')
ON CONFLICT (id) DO NOTHING;
+2
View File
@@ -18,6 +18,8 @@ export const env = {
embedding: {
provider: (process.env.EMBEDDING_PROVIDER ?? 'local') as 'mock' | 'local' | 'openai',
localModel: process.env.EMBEDDING_LOCAL_MODEL ?? 'Xenova/multilingual-e5-small',
// transformers.js 4.x 는 이 변수를 읽지 않아 node_modules 에 받는다 — 볼륨에 남기려면 직접 넘긴다.
cacheDir: process.env.TRANSFORMERS_CACHE || null,
},
dedup: {
cosineThreshold: num(process.env.DEDUP_COSINE_THRESHOLD, 0.99),
+1
View File
@@ -10,6 +10,7 @@ const industries = [
['health.dental', 'health.dental', '치과'],
['stay', 'stay', '숙박'],
['stay.pension', 'stay.pension', '펜션'],
['stay.hotel', 'stay.hotel', '호텔'],
];
const regions = [
+2 -1
View File
@@ -19,7 +19,8 @@ export class LocalEmbeddingProvider extends EmbeddingProvider {
if (!this.loading) {
this.loading = (async () => {
const t0 = Date.now();
const { pipeline } = await esmImport('@huggingface/transformers');
const { pipeline, env: tf } = await esmImport('@huggingface/transformers');
if (env.embedding.cacheDir) tf.cacheDir = env.embedding.cacheDir;
const fe = await pipeline('feature-extraction', env.embedding.localModel);
this.logger.log(`model ready: ${env.embedding.localModel} (${Date.now() - t0}ms)`);
this.extractor = fe;
@@ -103,6 +103,7 @@ export class GenerationService {
locale: 'ko-KR',
industryId: merchant.industry_id,
regionId: merchant.region_id,
source: keywordSource(this.llm.name),
});
stats.details.push({
@@ -214,3 +215,8 @@ export class GenerationService {
return created;
}
}
// mock 이 만든 단어를 'llm' 으로 두면 매칭 후보가 되어 가짜 단어가 발행본에 나간다.
function keywordSource(provider: string): string {
return provider === 'mock' ? 'mock' : 'llm';
}
+3
View File
@@ -26,6 +26,8 @@ export interface ResolveInput {
locale: string;
industryId: string | null;
regionId: string | null;
/** 새로 등록될 때 keyword.source — 매칭 후보 여부가 이 값으로 갈린다 */
source: string;
}
/** 4단계 계단식 중복제거. */
@@ -98,6 +100,7 @@ export class DedupService {
embedding: input.embedding,
industryId: input.industryId,
regionId: input.regionId,
source: input.source,
});
return { action: 'created', keywordId: created.id, canonical: created.canonical };
}
+3 -2
View File
@@ -81,11 +81,12 @@ export class KeywordRepository {
embedding: number[];
industryId: string | null;
regionId: string | null;
source: string;
}): Promise<KeywordRow> {
const rows = await this.sql<KeywordRow[]>`
INSERT INTO keyword (canonical, normalized, locale, intent, embedding, industry_id, region_id, usage_count)
INSERT INTO keyword (canonical, normalized, locale, intent, embedding, industry_id, region_id, usage_count, source)
VALUES (${input.canonical}, ${input.normalized}, ${input.locale}, ${input.intent},
${toVector(input.embedding)}::vector, ${input.industryId}, ${input.regionId}, 0)
${toVector(input.embedding)}::vector, ${input.industryId}, ${input.regionId}, 0, ${input.source})
ON CONFLICT (normalized, locale) DO UPDATE SET updated_at = now()
RETURNING id, canonical, normalized, aliases, intent, usage_count`;
return rows[0];
+4
View File
@@ -92,6 +92,10 @@ const SYSTEM_PROMPT = `당신은 한국 로컬 비즈니스 SEO/AEO 전문가입
- 지역명 + 업종 + 의도어 조합을 적극 활용합니다.
- 과장광고 표현(최고, 1위, 100%, 무조건, 완치 등)은 절대 사용하지 않습니다.
- 제공된 "이미 보유한 키워드"와 의미가 겹치는 것은 생성하지 않습니다.
- 시설·전망·객실 유형은 "상세"의 features·nearby 에 있는 것만 씁니다. 없는 것을 지어내지 않습니다.
- "상세"의 unverified 에 있는 항목은 확인되지 않은 것이므로 키워드와 답변 어디에도 쓰지 않습니다.
- 숙박 유형어는 주어진 업종의 것만 씁니다. 업종이 호텔이면 '펜션'을, 펜션이면 '호텔'을 붙이지 않습니다.
- 가격·최저가·할인 같은 가격 주장은 쓰지 않습니다.
- relevance 는 해당 업체와의 관련도를 0.0~1.0 으로 매깁니다.
- 답변(answer)은 2~3문장, 업체 정보에 근거한 사실만 씁니다.`;
+18 -5
View File
@@ -1,10 +1,13 @@
import { Body, Controller, Get, Param, Post, Query } from '@nestjs/common';
import { Body, Controller, Get, Logger, Param, Post, Query } from '@nestjs/common';
import { env } from '../config/env';
import { GenerationService } from '../generation/generation.service';
import { GenerationQueue } from '../generation/generation.queue';
import { MerchantsService, UpsertMerchantDto } from './merchants.service';
@Controller('v1/merchants')
export class MerchantsController {
private readonly logger = new Logger(MerchantsController.name);
constructor(
private readonly merchants: MerchantsService,
private readonly generation: GenerationService,
@@ -21,15 +24,25 @@ export class MerchantsController {
return this.merchants.findWithTaxonomy(id);
}
/** o2o-site-AEO 사이트 발행 웹훅: 업체 등록 + 키워드 생성 예약 */
/** 발행 웹훅 — 재빌드마다 불리므로 처음 보는 업체·기한 지난 업체만 생성해 LLM 요금을 묶는다 */
@Post('publish')
async publish(@Body() dto: UpsertMerchantDto & { generate?: boolean; sync?: boolean }) {
const merchant = await this.merchants.upsert(dto);
if (dto.generate === false) return { merchant, generation: 'skipped' };
if (!this.merchants.isStale(merchant, env.generation.refreshIntervalDays)) {
return { merchant, generation: 'fresh' };
}
if (dto.sync) {
const stats = await this.generation.runForMerchant(merchant.id, 'published');
return { merchant, generation: stats };
// 첫 발행부터 새 키워드가 실리도록 처음 보는 업체만 기다린다. 실패해도 사전 키워드로 발행은 나간다.
if (dto.sync && merchant.last_generated_at === null) {
try {
const stats = await this.generation.runForMerchant(merchant.id, 'published');
return { merchant, generation: { ...stats, details: undefined } };
} catch (err) {
const message = err instanceof Error ? err.message : String(err);
this.logger.warn(`[${merchant.name}] 동기 생성 실패 — 사전 키워드로만 매칭된다: ${message}`);
return { merchant, generation: { failed: true, error: message } };
}
}
const jobId = await this.queue.enqueue(merchant.id, 'published');
return { merchant, generation: { queued: true, jobId } };
@@ -83,6 +83,12 @@ export class MerchantsService {
LIMIT ${limit}`;
}
/** findStale 과 같은 기준을 행 하나에 — publish 가 생성 여부를 정할 때 쓴다 */
isStale(merchant: Pick<MerchantRow, 'last_generated_at'>, intervalDays: number): boolean {
if (!merchant.last_generated_at) return true;
return Date.now() - new Date(merchant.last_generated_at).getTime() > intervalDays * 86_400_000;
}
async markGenerated(merchantId: string) {
await this.sql`UPDATE merchant SET last_generated_at = now() WHERE id = ${merchantId}`;
}
+1 -1
View File
@@ -114,7 +114,7 @@ export function checkAmenity(keyword: string, facts: MerchantFacts): AmenityVerd
}
// ──────────────────────────────────────────── 서브 질의 빌더
const STAY_TYPE_HINTS = ['독채', '풀빌라', '스테이', '펜션', '글램핑', '카라반', '한옥', '민박', '감성'];
const STAY_TYPE_HINTS = ['독채', '풀빌라', '스테이', '펜션', '호텔', '리조트', '글램핑', '카라반', '한옥', '민박', '감성'];
const CAPACITY_TOKEN = /\d+\s*인|기준|최대|소규모|중규모|대규모|수용/;
/** 레인 설계 원칙 1. 레인끼리 겹치지 않게 한다. */
+23 -10
View File
@@ -15,6 +15,8 @@ const LANE_DEPTH = 50; // 레인당 후보 깊이 — 깊을수록 generic
const LANE_FLOOR = 0.80; // 이 코사인 미만은 그 레인에서 기여하지 않는다
// 매칭 후보로 인정하는 출처.
const MATCH_SOURCES = ['dataset', 'nationwide', 'manual'];
// LLM 이 만든 키워드도 후보다. 단 intent=brand 는 남의 상호이므로 그 업체 것만 받는다.
const LLM_SOURCE = 'llm';
interface Hit {
id: string; canonical: string; intent: string; kind: string;
@@ -49,8 +51,9 @@ export class MatchService {
const vectors = await this.embedder.embed(lanes.map((l) => l.text), 'query');
// 레인별 검색.
// 잎(stay.pension)이 아니라 뿌리(stay)로 좁힌다 — 펜션·호텔이 서로의 관련 키워드를 받고, 틀린 유형어는 호출측이 뺀다.
const perLane = await Promise.all(
vectors.map((v) => this.laneSearch(v, LANE_DEPTH, merchant?.industry_id ?? null)),
vectors.map((v) => this.laneSearch(v, LANE_DEPTH, industryRoot(merchant?.industry_path), merchant?.id ?? null)),
);
// 가중 RRF 융합
@@ -138,17 +141,22 @@ export class MatchService {
}
private async laneSearch(
embedding: number[], limit: number, industryId: string | null,
embedding: number[], limit: number, root: string | null, merchantId: string | null,
): Promise<Hit[]> {
const vec = toVector(embedding);
const rows = await this.sql<Hit[]>`
SELECT id, canonical, intent, kind, category, aliases,
1 - (embedding <=> ${vec}::vector) AS score
FROM keyword
WHERE embedding IS NOT NULL
AND source = ANY(${MATCH_SOURCES})
AND (${industryId}::text IS NULL OR industry_id IS NULL OR industry_id = ${industryId})
ORDER BY embedding <=> ${vec}::vector
SELECT k.id, k.canonical, k.intent, k.kind, k.category, k.aliases,
1 - (k.embedding <=> ${vec}::vector) AS score
FROM keyword k
LEFT JOIN industry i ON i.id = k.industry_id
WHERE k.embedding IS NOT NULL
AND (k.source = ANY(${MATCH_SOURCES})
OR (k.source = ${LLM_SOURCE}
AND (k.intent <> 'brand'
OR EXISTS (SELECT 1 FROM merchant_keyword mk
WHERE mk.keyword_id = k.id AND mk.merchant_id = ${merchantId}::uuid))))
AND (${root}::text IS NULL OR k.industry_id IS NULL OR i.path <@ ${root}::ltree)
ORDER BY k.embedding <=> ${vec}::vector
LIMIT ${limit}`;
return rows.map((r) => ({ ...r, score: Number(r.score) }));
}
@@ -185,11 +193,16 @@ export class MatchService {
async dictionarySize() {
const [row] = await this.sql<Array<{ n: number }>>`
SELECT count(*)::int AS n FROM keyword
WHERE embedding IS NOT NULL AND source = ANY(${MATCH_SOURCES})`;
WHERE embedding IS NOT NULL AND (source = ANY(${MATCH_SOURCES}) OR source = ${LLM_SOURCE})`;
return row?.n ?? 0;
}
}
/** 'stay.pension' → 'stay'. 업종이 없으면 null(좁히지 않는다) */
export function industryRoot(path: string | null | undefined): string | null {
return path ? path.split('.')[0] : null;
}
function str(v: unknown): string[] {
return Array.isArray(v) ? v.filter((x): x is string => typeof x === 'string') : [];
}
+14 -23
View File
@@ -7,11 +7,11 @@ import { EmbeddingProvider } from '../embedding/types';
import { MerchantsService, MerchantWithTaxonomy } from '../merchants/merchants.service';
const LODGING_ROOT = 'stay';
// 검색어 하나당 살펴볼 가까운 키워드 수. 한 숙소가 연결한 키워드는 15개 안팎이라 이 정도면 겹친다.
// 검색어 하나당 살펴볼 가까운 키워드 수(숙소에 연결된 키워드 중에서).
const SEARCH_KEYWORD_DEPTH = 60;
// ★ 짧은 한글 키워드는 전혀 다른 말도 코사인이 높다(dedup.service 실측: '선유도 펜션' ↔ '새만금 펜션' = 0.936).
// 그래서 벡터 갈래는 이 값 이상만 "같은 뜻" 으로 치고, 지역 구분은 벡터가 아니라 위치 갈래에 맡긴다.
const SEARCH_FLOOR = 0.94;
// e5-small 에서 맞는 숙소는 0.87 이상, 동떨어진 숙소는 0.86 아래로 갈린다. 지역 구분은 이 값이 아니라 지역 이름으로 한다.
// ponytail: 고정 임계값 — 숙소가 늘어 경계가 흐려지면 1위 대비 상대 컷으로 바꾼다.
const SEARCH_FLOOR = 0.87;
const SEARCH_SEO_KEYWORDS = 20;
export interface SeoPayload {
@@ -181,18 +181,7 @@ export class ServingService {
return row?.n ?? 0;
}
/**
* 검색어 → 그 말로 찾을 만한 숙소와 각 숙소의 SEO 메타.
*
* 두 갈래를 합친다.
* 키워드 — 검색어와 가까운 키워드(표기 변형은 aliases 로 흡수돼 있다)를 **가진** 숙소
* 위치 — 검색어에 지역 이름이 들어 있으면 그 지역(하위 포함) 숙소
* 위치가 맞는 숙소를 앞에 둔다. `군산 오션뷰` 로 찾는데 여수 오션뷰 숙소가 먼저 나오면 틀린 답이다.
*
* ★ 업종은 숙박 뿌리(stay.*)로 묶는다 — 펜션을 찾아도 관련 키워드를 가진 호텔이 함께 나온다(2026-09-30 지시).
* ★ 키워드 갈래는 merchant_keyword(생성 때 연결된 것)만 본다. /v1/match 의 추천은 저장되지 않으므로
* 생성이 한 번도 안 돈 숙소는 위치 갈래로만 잡힌다.
*/
/** 검색어 → 맞는 숙소(숙박 전체)와 SEO 메타. 키워드 갈래 + 지역 갈래, 지역을 말하면 그 지역만 */
async searchLodgings(rawQuery: string, limit: number) {
const query = rawQuery.trim();
if (!query) return { input: query, results: [] };
@@ -206,10 +195,11 @@ export class ServingService {
region_hit: boolean; score: number | null; matched: string[] | null;
}>>`
WITH near AS (
SELECT id, 1 - (embedding <=> ${vec}::vector) AS score
FROM keyword
WHERE embedding IS NOT NULL
ORDER BY embedding <=> ${vec}::vector
SELECT k.id, 1 - (k.embedding <=> ${vec}::vector) AS score
FROM keyword k
WHERE k.embedding IS NOT NULL
AND EXISTS (SELECT 1 FROM merchant_keyword mk WHERE mk.keyword_id = k.id AND mk.status = 'active')
ORDER BY k.embedding <=> ${vec}::vector
LIMIT ${SEARCH_KEYWORD_DEPTH}
), hits AS (
SELECT id, score FROM near WHERE score >= ${SEARCH_FLOOR}
@@ -221,7 +211,7 @@ export class ServingService {
SELECT m.external_id, r.name AS region, i.name AS industry,
COALESCE(bool_or(r.path <@ p.path), false) AS region_hit,
max(h.score) AS score,
array_remove(array_agg(DISTINCT k.canonical), NULL) AS matched
array_remove(array_agg(k.canonical ORDER BY h.score DESC), NULL) AS matched
FROM merchant m
JOIN industry i ON i.id = m.industry_id AND i.path <@ ${LODGING_ROOT}::ltree
LEFT JOIN region r ON r.id = m.region_id
@@ -230,7 +220,8 @@ export class ServingService {
LEFT JOIN hits h ON h.id = mk.keyword_id
LEFT JOIN keyword k ON k.id = h.id
GROUP BY m.id, r.name, i.name
HAVING max(h.score) IS NOT NULL OR bool_or(p.path IS NOT NULL)
HAVING (max(h.score) IS NOT NULL OR bool_or(p.path IS NOT NULL))
AND (NOT EXISTS (SELECT 1 FROM places) OR bool_or(p.path IS NOT NULL))
ORDER BY region_hit DESC, score DESC NULLS LAST, m.name
LIMIT ${limit}`;
@@ -241,7 +232,7 @@ export class ServingService {
industry: r.industry,
regionMatched: r.region_hit,
score: r.score === null ? null : Number(r.score),
matchedKeywords: r.matched ?? [],
matchedKeywords: [...new Set(r.matched ?? [])],
seo: await this.seo(r.external_id, SEARCH_SEO_KEYWORDS),
});
}
@@ -24,6 +24,8 @@
{ "key": "accommodation_capacity", "label": "수용 인원", "type": "number", "scope": "place", "required": false, "critical": false, "allow_llm": false, "unit": "명" },
{ "key": "building_scale", "label": "규모", "type": "text", "scope": "place", "required": false, "critical": false, "allow_llm": false },
{ "key": "intro", "label": "숙소 소개", "type": "text", "scope": "place", "required": false, "critical": false, "allow_llm": true },
{ "key": "tagline", "label": "캐치프레이즈", "type": "text", "scope": "place", "required": false, "critical": false, "allow_llm": true },
{ "key": "catchphrases", "label": "첫 화면 순환 문구", "type": "text", "scope": "place", "required": false, "critical": false, "allow_llm": true },
{ "key": "room_type", "label": "객실 타입", "type": "text", "scope": "unit", "required": true, "critical": false, "allow_llm": false },
{ "key": "standard_capacity", "label": "기준 인원", "type": "number", "scope": "unit", "required": true, "critical": true, "allow_llm": false, "unit": "명" },
@@ -0,0 +1,43 @@
"""순환 문구를 fact 한 칸에 담는 글 형식 — 사장님이 빌더에서 줄 단위로 고칠 수 있게 JSON 이 아니라 글로 둔다.
한 줄에 한 문구. 앞에 `봄 | ` · `9월 | ` · `비 | ` 를 붙이면 계절·월·날씨 문구, 없으면 일반 문구다.
"""
import re
SEASONS = ("봄", "여름", "가을", "겨울")
WEATHERS = ("맑음", "흐림", "비", "눈")
_MONTH = re.compile(r"^(1[0-2]|[1-9])월$")
def encode(items: list[dict]) -> str:
lines = []
for item in items:
text = str(item.get("text") or "").strip()
if not text:
continue
kind = item.get("kind") or "general"
tag = {"season": item.get("season"), "month": f"{item.get('month')}월", "weather": item.get("weather")}.get(kind)
lines.append(f"{tag} | {text}" if tag else text)
return "\n".join(lines)
def decode(value: str) -> list[dict]:
items: list[dict] = []
for raw in (value or "").splitlines():
line = raw.strip()
if not line:
continue
tag, sep, rest = line.partition("|")
tag, rest = tag.strip(), rest.strip()
if sep and rest:
if tag in SEASONS:
items.append({"text": rest, "kind": "season", "season": tag})
continue
if tag in WEATHERS:
items.append({"text": rest, "kind": "weather", "weather": tag})
continue
if m := _MONTH.match(tag):
items.append({"text": rest, "kind": "month", "month": int(m.group(1))})
continue
items.append({"text": line, "kind": "general"})
return items
+18 -2
View File
@@ -1,11 +1,15 @@
"""COPY 흐름."""
from common.enums import PlaceCategory
from common.logger import LOG
from services.copy_steps import CopyAborted, prepare_copy, generate_copy, save_copy, fill_faqs
from services.copy_steps import (
CopyAborted, fill_faqs, generate_catchphrases, generate_copy, prepare_copy, save_catchphrases, save_copy,
)
from services.external import gemini_text
from services.llm import provider
from services.llm.errors import LlmError
from services.job_progress import JobProgress
COPY_STEPS = ("prepare", "generate", "save", "faq_fill")
COPY_STEPS = ("prepare", "generate", "save", "catchphrase", "faq_fill")
async def run_copy(job: dict) -> dict:
@@ -34,6 +38,18 @@ async def run_copy(job: dict) -> dict:
async with progress.step("save"):
result = await save_copy(inputs, copy)
if inputs.place.category != PlaceCategory.LODGING.value:
await progress.skip("catchphrase", "not_lodging")
elif copy is None:
await progress.skip("catchphrase", "no_facts" if inputs.ungrounded else "not_configured")
else:
try:
async with progress.step("catchphrase"):
result["catchphrase"] = await save_catchphrases(inputs, await generate_catchphrases(inputs))
except LlmError as ex:
LOG.w(f"[copy] 첫 화면 문구 생성 실패, 공통 문구로 계속: {ex}")
await progress.skip("catchphrase", "generation_failed")
if inputs.catalog is not None:
async with progress.step("faq_fill"):
result["faq_fill"] = await fill_faqs(
+42 -1
View File
@@ -21,7 +21,7 @@ from crud.fact_crud import FactCRUD
from crud.faq_crud import FaqCRUD
from crud.place_crud import PlaceCRUD
from router.v1.fact.protocol import Req_UpsertFact
from services import faq_fill, place_research
from services import catchphrase_text, faq_fill, place_research
from services.external import gemini_text
from services.llm import provider
from services.fact_service import FactService
@@ -248,6 +248,47 @@ async def save_copy(inputs: CopyInputs, copy: gemini_text.GeneratedCopy | None)
return stat
async def generate_catchphrases(inputs: CopyInputs) -> gemini_text.GeneratedCatchphrases:
active_provider = provider.active()
model = (
external_api_config.openai_text_model if active_provider.__name__.endswith("openai")
else external_api_config.gemini_text_model
)
try:
return await gemini_text.generate_catchphrases(
inputs.place.name, inputs.grounded, records=inputs.records or None, model=model,
)
except gemini_text.GeminiNotConfigured as ex:
raise CopyAborted(str(ex)) from ex
async def save_catchphrases(inputs: CopyInputs, generated: gemini_text.GeneratedCatchphrases) -> dict:
place_id = str(inputs.place.place_id)
stat = {"tagline": False, "catchphrases": 0, "rejected": [list(r) for r in generated.rejected][:20]}
actor = UserInfo(user_id=str(inputs.place.owner_user_id), id="generator", role=1)
service = FactService(_fact_crud, _place_crud)
values = (("tagline", generated.tagline), ("catchphrases", catchphrase_text.encode(generated.items)))
for key, value in values:
spec = inputs.schema.get(key)
if not (value or "").strip() or not (spec and spec.allow_llm):
continue
res = await service.upsert_fact(
actor, place_id,
Req_UpsertFact(
key=key, value=value.strip(),
source_type=SourceType.LLM, source_url=f"llm:{generated.source or external_api_config.gemini_text_model}",
),
)
if not res.result.success:
stat["rejected"].append([key, res.result.desc])
elif key == "tagline":
stat["tagline"] = True
else:
stat["catchphrases"] = len(generated.items)
LOG.i(f"[copy] place={place_id} 캐치프레이즈 {'O' if stat['tagline'] else 'X'} · 순환 {stat['catchphrases']}개")
return stat
async def fill_faqs(pid: uuid.UUID, catalog: FaqCatalog, known_fact_keys: set[str], phone: str | None) -> int:
"""노출 중인 FAQ 가 목표 수에 모자란 만큼 문의 안내 문항을 넣는다."""
l_err, rows = await DB_SESSION_MNG.execute_lambda(
+85
View File
@@ -13,6 +13,7 @@ from services.llm import provider
from services.llm.errors import LlmError
from services.llm.errors import LlmInvalidOutput as GeminiInvalidOutput
from services.llm.errors import LlmNotConfigured as GeminiNotConfigured
from services.prompts import catchphrase as catchphrase_prompt
from services.prompts.copy import RESPONSE_SCHEMA, build_prompt
@@ -159,6 +160,90 @@ async def generate_copy(
return result
# ── 첫 화면 문구(generate_catchphrases) ─────────────────────────────────
@dataclass
class GeneratedCatchphrases:
tagline: Optional[str] = None
items: list[dict] = field(default_factory=list)
rejected: list[tuple[str, str]] = field(default_factory=list)
source: str = ""
async def generate_catchphrases(
place_name: str,
facts: list[FactInput],
*,
records: Optional[list[str]] = None,
model: Optional[str] = None,
max_retries: int = 2,
client: Optional[httpx.AsyncClient] = None,
) -> GeneratedCatchphrases:
"""고정 캐치프레이즈 하나와 순환 문구 모음 — 문구마다 소개문과 같은 근거 검사를 거친다."""
llm = provider.active()
if not llm.is_configured():
raise GeminiNotConfigured(f"{llm.__name__.rsplit('.', 1)[-1].upper()}_API_KEY 가 설정되지 않았다")
model = model or llm.DEFAULT_MODEL
grounding = list(facts) + [FactInput(key="place_name", label="상호명", value=place_name)]
prompt = catchphrase_prompt.build_prompt(place_name, facts, records)
owns_client = client is None
client = client or httpx.AsyncClient(timeout=httpx.Timeout(120.0, connect=10.0))
try:
llm_result = await llm.generate(
client, model, prompt=prompt, response_schema=catchphrase_prompt.RESPONSE_SCHEMA,
temperature=0.7, max_retries=max_retries,
)
finally:
if owns_client:
await client.aclose()
parsed = llm_result.json or {}
result = GeneratedCatchphrases(source=f"{llm.__name__.rsplit('.', 1)[-1]}:{model}")
seen: set[str] = set()
def accept(text: object) -> Optional[str]:
line = str(text or "").strip()
if not line or line in seen:
return None
if not (catchphrase_prompt.MIN_LEN <= len(line) <= catchphrase_prompt.MAX_LEN):
result.rejected.append((line, f"길이 {len(line)}자"))
return None
if place_name and place_name in line:
result.rejected.append((line, "상호명 포함"))
return None
ok, reasons = ground_check(line, grounding)
if not ok:
result.rejected.append((line, " / ".join(reasons)))
return None
seen.add(line)
return line
result.tagline = accept(parsed.get("tagline"))
for text in (parsed.get("general") or [])[: catchphrase_prompt.COUNT_GENERAL]:
if line := accept(text):
result.items.append({"text": line, "kind": "general"})
for row in parsed.get("season") or []:
season = (row or {}).get("season")
if season in catchphrase_prompt.SEASONS and (line := accept(row.get("text"))):
result.items.append({"text": line, "kind": "season", "season": season})
for row in parsed.get("month") or []:
month = (row or {}).get("month")
if isinstance(month, int) and 1 <= month <= 12 and (line := accept(row.get("text"))):
result.items.append({"text": line, "kind": "month", "month": month})
for row in parsed.get("weather") or []:
weather = (row or {}).get("weather")
if weather in catchphrase_prompt.WEATHERS and (line := accept(row.get("text"))):
result.items.append({"text": line, "kind": "weather", "weather": weather})
usage = llm_result.usage
LOG.i(
f"[llm-text] '{place_name}' 첫 화면 문구 — 캐치프레이즈 {'O' if result.tagline else 'X'} · "
f"순환 {len(result.items)}개 · 반려 {len(result.rejected)}건 · model={model} · "
f"tokens in={usage.input_tokens} out={usage.output_tokens} · 약 ${llm.price(model, usage)}"
)
return result
# ── 요약(summarize_text) ──────────────────────────────────────────────────
_SUMMARY_CACHE: dict[str, str] = {}
_SUMMARY_CACHE_MAX = 500
+8 -5
View File
@@ -7,6 +7,8 @@ from config.server_configs import external_api_config
# 로컬 임베딩 모델이라 호출당 1~2초다.
TIMEOUT_SEC = 15.0
# 처음 보는 업체는 publish 가 OpenAI 키워드 생성을 기다린다(키워드 15개 + 질문 5개).
PUBLISH_TIMEOUT_SEC = 60.0
DEFAULT_LIMIT = 40
PUBLISH_PATH = "/v1/merchants/publish"
@@ -25,8 +27,8 @@ def is_configured() -> bool:
return bool(base_url())
async def _post(client: httpx.AsyncClient, path: str, body: dict) -> dict:
res = await client.post(f"{base_url()}{path}", json=body)
async def _post(client: httpx.AsyncClient, path: str, body: dict, timeout: float = TIMEOUT_SEC) -> dict:
res = await client.post(f"{base_url()}{path}", json=body, timeout=timeout)
if res.status_code >= 400:
raise SiteOntologyError(f"{path} HTTP {res.status_code}: {res.text[:200]}")
try:
@@ -40,17 +42,18 @@ async def _post(client: httpx.AsyncClient, path: str, body: dict) -> dict:
async def match_for_merchant(merchant: dict, limit: int = DEFAULT_LIMIT) -> dict:
"""업체를 저장하고, 그 업체로 해석된 추천 결과(/v1/match 응답)를 돌려준다."""
body = {**merchant, "generate": False}
# sync 는 처음 보는 업체에만 먹는다 — 첫 발행부터 새 키워드가 실리고, 갱신은 저쪽 큐가 한다.
body = {**merchant, "generate": True, "sync": True}
try:
async with httpx.AsyncClient(timeout=TIMEOUT_SEC) as client:
try:
await _post(client, PUBLISH_PATH, body)
await _post(client, PUBLISH_PATH, body, PUBLISH_TIMEOUT_SEC)
except SiteOntologyError as ex:
if not body.get("regionId"):
raise
LOG.w(f"[site-ontology] regionId={body['regionId']} 로 저장하지 못했다 — 지역 없이 다시 보낸다: {ex}")
body = {**body, "regionId": None}
await _post(client, PUBLISH_PATH, body)
await _post(client, PUBLISH_PATH, body, PUBLISH_TIMEOUT_SEC)
result = await _post(client, MATCH_PATH, {"query": merchant["externalId"], "limit": limit})
except httpx.HTTPError as ex:
raise SiteOntologyError(f"{type(ex).__name__}: {ex}") from ex
@@ -0,0 +1,84 @@
"""숙소 첫 화면 문구 — 고정 캐치프레이즈 하나와 그 아래 줄에서 도는 문구 모음."""
from typing import Optional, Sequence
from services.prompts.copy import FactLike, _fact_lines
SEASONS = ("봄", "여름", "가을", "겨울")
WEATHERS = ("맑음", "흐림", "비", "눈")
COUNT_GENERAL = 20
COUNT_PER_SEASON = 3
COUNT_PER_WEATHER = 2
MIN_LEN = 8
MAX_LEN = 30
RESPONSE_SCHEMA = {
"type": "object",
"properties": {
"tagline": {"type": "string"},
"general": {"type": "array", "items": {"type": "string"}},
"season": {
"type": "array",
"items": {
"type": "object",
"properties": {"season": {"type": "string", "enum": list(SEASONS)}, "text": {"type": "string"}},
"required": ["season", "text"],
},
},
"month": {
"type": "array",
"items": {
"type": "object",
"properties": {"month": {"type": "integer"}, "text": {"type": "string"}},
"required": ["month", "text"],
},
},
"weather": {
"type": "array",
"items": {
"type": "object",
"properties": {"weather": {"type": "string", "enum": list(WEATHERS)}, "text": {"type": "string"}},
"required": ["weather", "text"],
},
},
},
"required": ["tagline", "general", "season", "month", "weather"],
}
def build_prompt(
place_name: str,
facts: Sequence[FactLike],
records: Optional[Sequence[str]] = None,
) -> str:
sections = [
f"숙소 '{place_name}' 홈페이지 첫 화면 문구를 쓴다.",
"첫 화면은 숙소 이름 아래 **고정 캐치프레이즈 한 줄**, 그 아래 줄에서 짧은 문구가 몇 초마다 바뀐다.",
"",
"확인된 사실:",
_fact_lines(facts) if facts else "- 없음",
]
if records:
sections.extend(["", "출처가 있는 기록:", *(f"- {line}" for line in records)])
sections.extend([
"",
"출력:",
f"- tagline: 이 숙소만의 캐치프레이즈 1개, {MIN_LEN}~{MAX_LEN}자. 이 집을 한 줄로 알아보게 하는 문장",
f"- general: 계절·날씨와 상관없는 문구 {COUNT_GENERAL}개",
f"- season: 봄·여름·가을·겨울 각 {COUNT_PER_SEASON}개",
"- month: 1월~12월 각 1개",
f"- weather: 맑음·흐림·비·눈 각 {COUNT_PER_WEATHER}개. 그 날씨에 이 집에서 보이고 들리는 것",
f"- 모든 문구는 공백 포함 {MIN_LEN}~{MAX_LEN}자, 한 문장",
"",
"좋은 예(다른 숙소): '백 년 된 집에서 하룻밤' · '담 너머는 히로쓰 가옥입니다' ·"
" '마당 평상에 앉으면 항구 소리가 들립니다' · '이불에서 볕 냄새가 납니다'",
"",
"규칙:",
"- 위 사실과 기록에 있는 것만 쓴다. 없는 시설·경관·숫자·거리·역사를 지어내지 않는다.",
"- 사실이 적으면 머무는 시간·쉼처럼 확인이 필요 없는 말로 쓴다.",
"- 담백하게 쓴다. '최고', '완벽한', '특별한', '힐링' 같은 홍보 수식어와 느낌표를 쓰지 않는다.",
"- 문구끼리 표현이 겹치지 않게 한다. 상호명은 tagline 에도 넣지 않는다.",
"- false·불가·없음 값을 있는 것처럼 쓰지 않는다.",
"- 존댓말 평서문 또는 명사형으로 끝낸다.",
])
return "\n".join(sections)
+23 -12
View File
@@ -9,6 +9,9 @@ from services.external import site_ontology
from services.site_payload import _parse_address_parts
LODGING_INDUSTRY = "stay.pension"
HOTEL_INDUSTRY = "stay.hotel"
# 업종별 숙박 유형어. 자기 유형어만 자료 없이 통과한다 — 호텔에 `군산 독채펜션` 이 붙지 않게.
_TYPE_WORDS = {LODGING_INDUSTRY: "펜션", HOTEL_INDUSTRY: "호텔"}
MAX_KEYWORDS = 10
MAX_NEARBY = 8
@@ -57,9 +60,9 @@ _REGION_KEYS = {
}
# 자료에 없어도 되는 낱말 — 업종어와 "근처" 류.
_GENERIC_WORDS = frozenset({"펜션", "숙소", "숙박", "스테이", "근처", "가까운", "주변", "인근", "예약", "추천"})
_GENERIC_WORDS = frozenset({"숙소", "숙박", "스테이", "근처", "가까운", "주변", "인근", "예약", "추천"})
# "독채펜션"·"감성숙소" 처럼 붙여 쓴 업종어는 떼고 앞부분만 자료와 대조한다.
_GENERIC_SUFFIXES = ("펜션", "숙소", "스테이")
_GENERIC_SUFFIXES = ("숙소", "스테이")
# 제목에는 싣지 않는 낱말.
_TITLE_BLOCKED_WORDS = frozenset({"예약", "추천"})
# 한 글자 낱말("봄"·"뷰")은 소개문 어딘가에 우연히 들어 있어 대조가 무의미하다 — 통과시키지 않는다.
@@ -102,6 +105,12 @@ def _locality_word(*addresses: str | None) -> str:
return word[:-1] if len(word) > 2 and word.endswith(("시", "군", "구")) else word
def industry_of(place: dict) -> str:
"""외부 분류(없으면 상호)에 '호텔' 이 있으면 호텔, 아니면 펜션."""
text = f"{_text(place.get('external_category'))} {_text(place.get('name'))}"
return HOTEL_INDUSTRY if "호텔" in text else LODGING_INDUSTRY
def build_merchant(place_id: str, snapshot: dict) -> dict | None:
"""스냅샷 → SiteOntology publish 요청 본문."""
place = (snapshot or {}).get("place") or {}
@@ -157,7 +166,7 @@ def build_merchant(place_id: str, snapshot: dict) -> dict | None:
return {
"externalId": place_id,
"name": name,
"industryId": LODGING_INDUSTRY,
"industryId": industry_of(place),
"regionId": region_key(road_address, address),
"description": description,
"profile": {key: value for key, value in profile.items() if value},
@@ -174,13 +183,14 @@ def _evidence(merchant: dict) -> str:
return _compact(" ".join(_text(p) for p in parts if p))
def _supported(keyword: str, evidence: str) -> bool:
def _supported(keyword: str, evidence: str, type_word: str = "펜션") -> bool:
"""모든 낱말이 자료에 있고, **자료로 확인한 낱말이 하나는 있어야** 한다."""
suffixes = (*_GENERIC_SUFFIXES, type_word)
specific = False
for word in keyword.split():
if word in _GENERIC_WORDS:
if word in _GENERIC_WORDS or word == type_word:
continue
core = next((word[: -len(s)] for s in _GENERIC_SUFFIXES if word.endswith(s) and len(word) > len(s)), word)
core = next((word[: -len(s)] for s in suffixes if word.endswith(s) and len(word) > len(s)), word)
core = _compact(core)
if len(core) < _MIN_CORE_LEN or core not in evidence:
return False
@@ -193,15 +203,15 @@ def _is_question(item: dict) -> bool:
return item.get("category") == "질문형" or "?" in canonical or canonical.endswith(("요", "까"))
def _usable(item, evidence: str) -> str | None:
def _usable(item, evidence: str, type_word: str) -> str | None:
"""메타 태그에 실어도 되는 추천이면 그 표기를, 아니면 None."""
if not isinstance(item, dict) or item.get("status") != "ok" or _is_question(item):
return None
canonical = _text(item.get("canonical"))
return canonical if canonical and _supported(canonical, evidence) else None
return canonical if canonical and _supported(canonical, evidence, type_word) else None
def _title_keyword(result: dict, evidence: str, locality: str) -> str | None:
def _title_keyword(result: dict, evidence: str, locality: str, type_word: str) -> str | None:
"""제목 업종어 자리에 넣을 대표 키워드 — 유형 레인에서 고른다."""
lane = next(
(l for l in result.get("byLane") or [] if isinstance(l, dict) and l.get("key") == "type"),
@@ -209,7 +219,7 @@ def _title_keyword(result: dict, evidence: str, locality: str) -> str | None:
)
items = [i for i in lane.get("items") or [] if isinstance(i, dict)]
for item in sorted(items, key=lambda i: i.get("category") != "코어"):
canonical = _usable(item, evidence)
canonical = _usable(item, evidence, type_word)
if not canonical or _TITLE_BLOCKED_WORDS.intersection(canonical.split()):
continue
if locality and locality not in canonical:
@@ -221,10 +231,11 @@ def _title_keyword(result: dict, evidence: str, locality: str) -> str | None:
def select(result: dict, merchant: dict) -> dict:
"""/v1/match 응답 → {keywords, titleKeyword?}."""
evidence = _evidence(merchant)
type_word = _TYPE_WORDS.get(merchant.get("industryId"), _TYPE_WORDS[LODGING_INDUSTRY])
keywords: list[str] = []
seen: set[str] = set()
for item in result.get("matches") or []:
canonical = _usable(item, evidence)
canonical = _usable(item, evidence, type_word)
if not canonical or _compact(canonical) in seen:
continue
seen.add(_compact(canonical))
@@ -233,7 +244,7 @@ def select(result: dict, merchant: dict) -> dict:
break
seo: dict = {"keywords": keywords}
title = _title_keyword(result, evidence, _locality_word((merchant.get("profile") or {}).get("address")))
title = _title_keyword(result, evidence, _locality_word((merchant.get("profile") or {}).get("address")), type_word)
if title:
seo["titleKeyword"] = title
return seo
+13 -1
View File
@@ -18,6 +18,7 @@ from common.enums import (
)
from common.logger import LOG
from common.template_catalog import TEMPLATES, industry_of, resolve_template_id
from services import catchphrase_text
from services.intro_summary import summarize_intro
from services.stay_guide import nol_stay_guide
from services.weather_notes import weather_notes
@@ -33,6 +34,9 @@ DEFAULT_PAYLOAD_DIR = "/app/solution/site/payloads"
SITE_HOST_ENV = "SITE_PUBLIC_HOST"
DEFAULT_HOST = os.environ.get(SITE_HOST_ENV, "").strip() or "localhost"
_HERO_COPY_KEYS = {"tagline", "catchphrases"}
def _scheme(host: str) -> str:
"""localhost 는 http 다."""
return "http" if re.match(r"^(localhost|127\.0\.0\.1)(:\d+)?$", host) else "https"
@@ -596,6 +600,14 @@ def to_site_payload(place, snapshot: dict, site, version, links, publish: bool =
# 요약은 **첫 문장**이다.
"summary": _first_sentence(paragraphs[0]) if paragraphs else None,
}
tagline = _text(next((f["value"] for f in place_facts if f["key"] == "tagline" and f["value"]), ""))
if tagline:
narrative["tagline"] = tagline.strip()
rotating = catchphrase_text.decode(
_text(next((f["value"] for f in place_facts if f["key"] == "catchphrases" and f["value"]), ""))
)
if rotating:
narrative["catchphrases"] = {"version": 1, "items": rotating}
theme = _theme(site, category)
@@ -651,7 +663,7 @@ def to_site_payload(place, snapshot: dict, site, version, links, publish: bool =
),
"kakaoPlaceId": kakao_place_id or None,
},
"facts": place_facts,
"facts": [f for f in place_facts if f["key"] not in _HERO_COPY_KEYS],
"units": units,
"media": media,
"faqs": faqs,
+2
View File
@@ -109,6 +109,8 @@ async def build_snapshot(place) -> dict:
"name": place.name,
"category": category.value,
"category_name": schema.label,
# 숙박 안의 유형(호텔·펜션) 판정 근거 — services/seo_keywords.industry_of
"external_category": getattr(place, "external_category", None),
"road_address": place.road_address,
"address": place.address,
"phone": place.phone,
@@ -0,0 +1,26 @@
"""순환 문구 글 형식 — 사장님이 줄 단위로 고친 글이 그대로 계절·월·날씨 문구로 읽혀야 한다."""
from services import catchphrase_text
def test_round_trips_every_kind():
items = [
{"text": "백 년 된 집에서 하룻밤", "kind": "general"},
{"text": "봄에는 대문을 열어 둡니다", "kind": "season", "season": "봄"},
{"text": "새해 첫 아침을 이 집에서", "kind": "month", "month": 1},
{"text": "기와에 빗소리가 납니다", "kind": "weather", "weather": "비"},
]
text = catchphrase_text.encode(items)
assert text.splitlines() == [
"백 년 된 집에서 하룻밤",
"봄 | 봄에는 대문을 열어 둡니다",
"1월 | 새해 첫 아침을 이 집에서",
"비 | 기와에 빗소리가 납니다",
]
assert catchphrase_text.decode(text) == items
def test_unknown_tag_stays_a_general_line():
assert catchphrase_text.decode("장마 | 비가 옵니다\n\n 13월 | 없는 달 ") == [
{"text": "장마 | 비가 옵니다", "kind": "general"},
{"text": "13월 | 없는 달", "kind": "general"},
]
+29 -2
View File
@@ -30,6 +30,15 @@ def _patch(monkeypatch, copy):
monkeypatch.setattr(gemini_text, "generate_copy", _gen)
async def _phrases(place_name, facts, **kw):
return gemini_text.GeneratedCatchphrases(
tagline="체크인 오후 세 시, 조용한 집",
items=[{"text": "짐을 풀면 골목부터 걸어 보세요", "kind": "general"},
{"text": "봄에는 창을 열어 둡니다", "kind": "season", "season": "봄"}],
)
monkeypatch.setattr(gemini_text, "generate_catchphrases", _phrases)
async def _place_with_facts(client, h, n_verified=5):
pid = (await client.post("/v1/place", headers=h, json={"name": "카피펜션", "category": 1})).json()["place"]["place_id"]
@@ -96,7 +105,7 @@ async def test_resume_reuses_completed_job(auth_headers, client, db_engine, monk
job = (await client.get(f"/v1/job/{first['job_id']}", headers=h)).json()["job"]
assert job["place_id"] == pid
assert [(s["id"], s["status"]) for s in job["progress"]["steps"]] == [
("prepare", "done"), ("generate", "done"), ("save", "done"), ("faq_fill", "done"),
("prepare", "done"), ("generate", "done"), ("save", "done"), ("catchphrase", "done"), ("faq_fill", "done"),
]
fresh = (await client.post(path, headers=h, json={})).json()
assert fresh["job_id"] != first["job_id"]
@@ -111,7 +120,7 @@ async def test_copy_progress_is_visible_during_generation(auth_headers, client,
async def generate(*args, **kwargs):
row = await JobQueue().get(started["job_id"])
assert row["status"] == JobStatus.RUNNING.value
assert [step["status"] for step in row["progress"]["steps"]] == ["done", "running", "pending", "pending"]
assert [step["status"] for step in row["progress"]["steps"]] == ["done", "running", "pending", "pending", "pending"]
return _copy()
monkeypatch.setattr(gemini_text, "generate_copy", generate)
@@ -303,3 +312,21 @@ async def test_copy_requires_api_key(auth_headers, client, monkeypatch):
pid = await _place_with_facts(client, h)
r = await client.post(f"/v1/place/{pid}/copy", headers=h, json={})
assert r.json()["result"]["code"] == ErrorType.GENERATOR_NOT_CONFIGURED.value
async def test_copy_writes_one_catchphrase_and_the_rotating_lines(auth_headers, client, db_engine, monkeypatch):
_patch(monkeypatch, _copy())
h = await auth_headers("catchphrase-owner")
pid = await _place_with_facts(client, h)
job_id = (await client.post(f"/v1/place/{pid}/copy", headers=h, json={})).json()["job_id"]
await Worker("w", JobQueue(), build_handler(), job_deadline_sec=30).drain()
job = (await client.get(f"/v1/job/{job_id}", headers=h)).json()["job"]
assert job["result"]["catchphrase"]["tagline"] is True
assert job["result"]["catchphrase"]["catchphrases"] == 2
async with db_engine.begin() as c:
rows = dict((await c.execute(
text("SELECT key, value FROM place_facts WHERE place_id = :p AND key IN ('tagline', 'catchphrases')"),
{"p": uuid.UUID(pid)},
)).all())
assert rows["tagline"] == "체크인 오후 세 시, 조용한 집"
assert rows["catchphrases"] == "짐을 풀면 골목부터 걸어 보세요\n봄 | 봄에는 창을 열어 둡니다"
@@ -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["하조대펜션에서 쉬세요"] == "상호명 포함"
+31 -2
View File
@@ -177,8 +177,8 @@ async def test_업체를_저장한_뒤_그_업체로_추천을_받는다(ontolog
await site_ontology.match_for_merchant(merchant)
assert [url for url, _ in sent] == ["http://onto.test/v1/merchants/publish", "http://onto.test/v1/match"]
# generate:false 가 빠지면 SiteOntology 가 LLM 키워드 생성을 큐에 넣는다.
assert sent[0][1] == {**merchant, "generate": False}
# 처음 보는 업체는 생성을 기다려 첫 발행부터 새 키워드가 실린다(sync 는 저쪽이 처음 보는 업체에만 먹인다).
assert sent[0][1] == {**merchant, "generate": True, "sync": True}
assert sent[1][1] == {"query": "place-1", "limit": site_ontology.DEFAULT_LIMIT}
@@ -296,3 +296,32 @@ async def test_SiteOntology_가_죽어도_발행된다(auth_headers, client, db_
assert site["site"]["status"] == SiteStatus.PUBLISHED.value
payload = json.loads(open(r["payload_path"], encoding="utf-8").read())
assert "seo" not in payload
# ── 호텔 ───────────────────────────────────────────────────────────────────
def test_외부_분류에_호텔이_있으면_호텔_업종으로_보낸다():
merchant = seo_keywords.build_merchant("place-1", _snapshot(external_category="여행 > 숙박 > 호텔"))
assert merchant["industryId"] == "stay.hotel"
def test_외부_분류가_없으면_상호로_가른다():
assert seo_keywords.build_merchant("place-1", _snapshot(name="군산 베이 호텔"))["industryId"] == "stay.hotel"
assert seo_keywords.build_merchant("place-1", _snapshot())["industryId"] == "stay.pension"
def _item(canonical):
return {"canonical": canonical, "status": "ok", "category": "코어"}
def test_호텔에는_펜션_유형어를_싣지_않는다():
merchant = seo_keywords.build_merchant("place-1", _snapshot(name="군산 베이 호텔"))
result = {"matches": [_item("군산 독채펜션"), _item("군산 독채 호텔"), _item("말랭이마을 숙소")]}
assert seo_keywords.select(result, merchant)["keywords"] == ["군산 독채 호텔", "말랭이마을 숙소"]
def test_펜션에는_호텔_유형어를_싣지_않는다():
merchant = seo_keywords.build_merchant("place-1", _snapshot())
result = {"matches": [_item("군산 독채 호텔"), _item("군산 독채펜션")]}
assert seo_keywords.select(result, merchant)["keywords"] == ["군산 독채펜션"]
@@ -0,0 +1,104 @@
Copyright (c) 2021, Kil Hyung-jin (https://github.com/orioncactus/pretendard),
with Reserved Font Name 'Pretendard'.
Copyright 2014-2021 Adobe (http://www.adobe.com/),
with Reserved Font Name 'Source'.
Source is a trademark of Adobe in the United States and/or other countries.
Copyright (c) 2016 The Inter Project Authors (https://github.com/rsms/inter),
with Reserved Font Name 'Inter'.
Copyright 2021 The M+ FONTS Project Authors (https://github.com/coz-m/MPLUS_FONTS),
with Reserved Font Name 'M PLUS 1'.
This Font Software is licensed under the SIL Open Font License, Version 1.1.
This license is copied below, and is also available with a FAQ at:
https://scripts.sil.org/OFL
-----------------------------------------------------------
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
-----------------------------------------------------------
PREAMBLE
The goals of the Open Font License (OFL) are to stimulate worldwide
development of collaborative font projects, to support the font creation
efforts of academic and linguistic communities, and to provide a free and
open framework in which fonts may be shared and improved in partnership
with others.
The OFL allows the licensed fonts to be used, studied, modified and
redistributed freely as long as they are not sold by themselves. The
fonts, including any derivative works, can be bundled, embedded,
redistributed and/or sold with any software provided that any reserved
names are not used by derivative works. The fonts and derivatives,
however, cannot be released under any other type of license. The
requirement for fonts to remain under this license does not apply
to any document created using the fonts or their derivatives.
DEFINITIONS
"Font Software" refers to the set of files released by the Copyright
Holder(s) under this license and clearly marked as such. This may
include source files, build scripts and documentation.
"Reserved Font Name" refers to any names specified as such after the
copyright statement(s).
"Original Version" refers to the collection of Font Software components as
distributed by the Copyright Holder(s).
"Modified Version" refers to any derivative made by adding to, deleting,
or substituting -- in part or in whole -- any of the components of the
Original Version, by changing formats or by porting the Font Software to a
new environment.
"Author" refers to any designer, engineer, programmer, technical
writer or other person who contributed to the Font Software.
PERMISSION & CONDITIONS
Permission is hereby granted, free of charge, to any person obtaining
a copy of the Font Software, to use, study, copy, merge, embed, modify,
redistribute, and sell modified and unmodified copies of the Font
Software, subject to the following conditions:
1) Neither the Font Software nor any of its individual components,
in Original or Modified Versions, may be sold by itself.
2) Original or Modified Versions of the Font Software may be bundled,
redistributed and/or sold with any software, provided that each copy
contains the above copyright notice and this license. These can be
included either as stand-alone text files, human-readable headers or
in the appropriate machine-readable metadata fields within text or
binary files as long as those fields can be easily viewed by the user.
3) No Modified Version of the Font Software may use the Reserved Font
Name(s) unless explicit written permission is granted by the corresponding
Copyright Holder. This restriction only applies to the primary font name as
presented to the users.
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
Software shall not be used to promote, endorse or advertise any
Modified Version, except to acknowledge the contribution(s) of the
Copyright Holder(s) and the Author(s) or with their explicit written
permission.
5) The Font Software, modified or unmodified, in part or in whole,
must be distributed entirely under this license, and must not be
distributed under any other license. The requirement for fonts to
remain under this license does not apply to any document created
using the Font Software.
TERMINATION
This license becomes null and void if any of the above conditions are
not met.
DISCLAIMER
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
OTHER DEALINGS IN THE FONT SOFTWARE.
@@ -3,6 +3,7 @@ export const GENERATION_LABELS: Record<string, string> = {
prepare: '수집된 사진 분류 및 대체 텍스트 생성',
generate: '브랜드 컬러 시스템 및 타이포그래피 조합',
save: '확인된 사실만으로 소개 콘텐츠 구성',
catchphrase: '첫 화면 캐치프레이즈와 순환 문구 작성',
faq_fill: '위치 기반 길찾기 연동 및 구조화 데이터(JSON-LD) 준비',
};
@@ -10,5 +11,6 @@ export const SKIP_REASONS: Record<string, string> = {
no_facts: '확인된 정보 없음',
not_configured: '생성 서비스 미설정',
no_catalog: '공통 질문 대상 업종 아님',
not_lodging: '숙박 업종만 해당',
generation_failed: '생성 서비스 응답 실패 — 확인된 정보만으로 계속합니다',
};
+11 -2
View File
@@ -322,10 +322,19 @@ export interface RouteEntry {
}
export interface Narrative {
/** 히어로 둘째 줄에서 순환할 문구. */
/** 히어로 둘째 줄에서 순환할 문구. 첫째 줄(캐치프레이즈)은 `tagline` 하나로 고정이다. */
catchphrases?: {
version: 1;
items: {text: string; kind?: 'general' | 'season' | 'month' | 'weather'}[];
items: {
text: string;
kind?: 'general' | 'season' | 'month' | 'weather';
/** kind=season 일 때 봄·여름·가을·겨울. */
season?: string;
/** kind=month 일 때 1~12. */
month?: number;
/** kind=weather 일 때 맑음·흐림·비·눈. */
weather?: string;
}[];
};
heroHeadline?: string;
@@ -0,0 +1,104 @@
Copyright (c) 2021, Kil Hyung-jin (https://github.com/orioncactus/pretendard),
with Reserved Font Name 'Pretendard'.
Copyright 2014-2021 Adobe (http://www.adobe.com/),
with Reserved Font Name 'Source'.
Source is a trademark of Adobe in the United States and/or other countries.
Copyright (c) 2016 The Inter Project Authors (https://github.com/rsms/inter),
with Reserved Font Name 'Inter'.
Copyright 2021 The M+ FONTS Project Authors (https://github.com/coz-m/MPLUS_FONTS),
with Reserved Font Name 'M PLUS 1'.
This Font Software is licensed under the SIL Open Font License, Version 1.1.
This license is copied below, and is also available with a FAQ at:
https://scripts.sil.org/OFL
-----------------------------------------------------------
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
-----------------------------------------------------------
PREAMBLE
The goals of the Open Font License (OFL) are to stimulate worldwide
development of collaborative font projects, to support the font creation
efforts of academic and linguistic communities, and to provide a free and
open framework in which fonts may be shared and improved in partnership
with others.
The OFL allows the licensed fonts to be used, studied, modified and
redistributed freely as long as they are not sold by themselves. The
fonts, including any derivative works, can be bundled, embedded,
redistributed and/or sold with any software provided that any reserved
names are not used by derivative works. The fonts and derivatives,
however, cannot be released under any other type of license. The
requirement for fonts to remain under this license does not apply
to any document created using the fonts or their derivatives.
DEFINITIONS
"Font Software" refers to the set of files released by the Copyright
Holder(s) under this license and clearly marked as such. This may
include source files, build scripts and documentation.
"Reserved Font Name" refers to any names specified as such after the
copyright statement(s).
"Original Version" refers to the collection of Font Software components as
distributed by the Copyright Holder(s).
"Modified Version" refers to any derivative made by adding to, deleting,
or substituting -- in part or in whole -- any of the components of the
Original Version, by changing formats or by porting the Font Software to a
new environment.
"Author" refers to any designer, engineer, programmer, technical
writer or other person who contributed to the Font Software.
PERMISSION & CONDITIONS
Permission is hereby granted, free of charge, to any person obtaining
a copy of the Font Software, to use, study, copy, merge, embed, modify,
redistribute, and sell modified and unmodified copies of the Font
Software, subject to the following conditions:
1) Neither the Font Software nor any of its individual components,
in Original or Modified Versions, may be sold by itself.
2) Original or Modified Versions of the Font Software may be bundled,
redistributed and/or sold with any software, provided that each copy
contains the above copyright notice and this license. These can be
included either as stand-alone text files, human-readable headers or
in the appropriate machine-readable metadata fields within text or
binary files as long as those fields can be easily viewed by the user.
3) No Modified Version of the Font Software may use the Reserved Font
Name(s) unless explicit written permission is granted by the corresponding
Copyright Holder. This restriction only applies to the primary font name as
presented to the users.
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
Software shall not be used to promote, endorse or advertise any
Modified Version, except to acknowledge the contribution(s) of the
Copyright Holder(s) and the Author(s) or with their explicit written
permission.
5) The Font Software, modified or unmodified, in part or in whole,
must be distributed entirely under this license, and must not be
distributed under any other license. The requirement for fonts to
remain under this license does not apply to any document created
using the Font Software.
TERMINATION
This license becomes null and void if any of the above conditions are
not met.
DISCLAIMER
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
OTHER DEALINGS IN THE FONT SOFTWARE.
Binary file not shown.
+1 -1
View File
@@ -46,7 +46,7 @@ it('고택은 섹션 순서와 상관없이 날씨를 첫 화면 바로 아래
payload.theme.sections = [...payload.theme.sections.filter((s) => s.id !== 'weather'), ...(weather ? [weather] : [])];
const html = renderToStaticMarkup(<App payload={payload} />);
const hero = html.indexOf('class="hero"');
const brief = html.indexOf('class="wbrief"');
const brief = html.indexOf('data-editor-id="weather"');
expect(hero).toBeGreaterThan(-1);
expect(brief).toBeGreaterThan(hero);
expect(html.slice(hero, brief)).not.toContain('class="sec');
+14 -4
View File
@@ -2,6 +2,7 @@ import {useState} from 'react';
import type {LocalPlace} from '@o2o/shared';
import {useSite} from '@site/lib/site-context';
import {naverMapSearchUrl} from '@site/lib/format';
import {PhotoCard} from '../kit/Card';
import {Sheet} from '../paper/Sheet';
import {Idx} from './SectionHead';
import {Tabs} from './Tabs';
@@ -66,6 +67,17 @@ export function Around() {
</li>
);
const spot = (place: LocalPlace) => (
<PhotoCard
key={place.name}
image={place.imageUrl}
title={place.name}
meta={place.distanceText}
desc={place.description}
onClick={() => setOpen(place)}
/>
);
return (
<>
{rail.length > 0 && (
@@ -86,16 +98,14 @@ export function Around() {
<section id="walk" aria-labelledby="walk-heading">
<Idx id="walk-heading" title="주변 명소" aside={`${spots.length} Spots`} />
<Tabs items={rangeTabs(spots)} value={spotRange} onChange={setSpotRange} />
<ul className="guide">{shownSpots.slice(0, firstSpots).map((place, i) => item(place, i))}</ul>
<div className="kgrid">{shownSpots.slice(0, firstSpots).map(spot)}</div>
{shownSpots.length > firstSpots && (
<details>
<summary className="line">
<span>{shownSpots.length - firstSpots}곳 더 보기</span>
<span>+</span>
</summary>
<ul className="guide">
{shownSpots.slice(firstSpots).map((place, i) => item(place, i + firstSpots))}
</ul>
<div className="kgrid">{shownSpots.slice(firstSpots).map(spot)}</div>
</details>
)}
</section>
+7 -11
View File
@@ -2,6 +2,7 @@ import {useState} from 'react';
import type {FestivalEntry} from '@o2o/shared';
import {useSite} from '@site/lib/site-context';
import {naverSearchUrl} from '@site/lib/format';
import {PhotoCard} from '../kit/Card';
import {Car} from '../paper/Car';
import {Sheet} from '../paper/Sheet';
import {Idx} from './SectionHead';
@@ -34,17 +35,12 @@ export function Festival() {
arrows
label="계절별 축제"
slides={shown.map((f) => (
<button type="button" className="fc" onClick={() => setOpen(f)}>
{f.imageUrl ? (
<span className="ph">
<img src={f.imageUrl} alt={f.name} loading="lazy" />
</span>
) : (
<span className="noimg">{f.name}</span>
)}
<span className="t">{f.name}</span>
<span className="d">{[f.month, f.location].filter(Boolean).join(' · ')}</span>
</button>
<PhotoCard
image={f.imageUrl}
title={f.name}
meta={[f.month, f.location].filter(Boolean).join(' · ')}
onClick={() => setOpen(f)}
/>
))}
/>
</div>
+2 -2
View File
@@ -1,5 +1,5 @@
import {PlaceCategory} from '@o2o/shared';
import {HeroCatchphrase} from '@site/sections/HeroCatchphrase';
import {HeroCatchphrase, HeroRotator} from '@site/sections/HeroCatchphrase';
import {useSite} from '@site/lib/site-context';
import {bookingActionLabel, bookingLinks, isSectionEnabled, stayBookingView} from '@site/lib/derive';
import {BOOK_EVENT} from '../paper/Rooms';
@@ -29,7 +29,7 @@ export function Hero() {
<span className="no" /> 오늘의 문장
</p>
{(lodging || fixed) && <p className="rot">{lodging ? <HeroCatchphrase /> : fixed}</p>}
{lodging && fixed && <p className="m sub">{fixed}</p>}
<HeroRotator className="m sub" />
<div className="hx">
{stay ? (
<button type="button" className="line line--ink" onClick={() => window.dispatchEvent(new Event(BOOK_EVENT))}>
@@ -284,3 +284,7 @@
.w4-bigtype .ppl{grid-template-columns:repeat(auto-fit,minmax(220px,1fr))}
.w4-bigtype .amen{grid-template-columns:repeat(auto-fit,minmax(220px,1fr))}}
.w4-bigtype .lead+:is(.chips,.tabrow){margin-top:20px}
.w4-bigtype{--kc-r:0;--kc-tw:500;--kc-ts:17px;--kc-mc:var(--sub);--kc-sub:var(--sub);--kc-px:12px;--kc-pb:14px}
.w4-bigtype .kgrid{gap:0;margin-top:0;border-top:1px solid var(--line);width:calc(100% + 1px);clip-path:inset(0 1px 0 0)}
.w4-bigtype .kgrid>.kcard{border-right:1px solid var(--line);border-bottom:1px solid var(--line)}
@media (min-width:1024px){.w4-bigtype .kgrid{grid-template-columns:repeat(4,minmax(0,1fr));gap:0}}
+15 -3
View File
@@ -2,6 +2,7 @@ import {useState} from 'react';
import type {LocalPlace} from '@o2o/shared';
import {useSite} from '@site/lib/site-context';
import {naverMapSearchUrl} from '@site/lib/format';
import {PhotoCard} from '../kit/Card';
import {Sheet} from '../paper/Sheet';
const WALK = 80;
@@ -70,6 +71,17 @@ export function Around() {
</button>
);
const spot = (item: LocalPlace) => (
<PhotoCard
key={item.name}
image={item.imageUrl}
title={item.name}
meta={item.distanceText}
desc={item.description}
onClick={() => setOpen(item)}
/>
);
return (
<>
{rail.length > 0 && (
@@ -78,7 +90,7 @@ export function Around() {
<p className="label">AROUND</p>
<h2 id="around-heading">주변 안내</h2>
<p className="lead">걸어서 닿는 명소와 맛집입니다.</p>
<div className="guide">{rail.slice(0, HOME_ROWS).map((item) => place(item))}</div>
<div className="guide guide--card">{rail.slice(0, HOME_ROWS).map(spot)}</div>
<a className="link b-more--c" href="#/area">
지역 소개에서 모두 보기
</a>
@@ -95,11 +107,11 @@ export function Around() {
</h2>
<p className="lead">걸어서 닿는 곳부터 차로 가는 곳까지 묶었습니다.</p>
<RangeTabs places={spots} value={spotRange} onChange={setSpotRange} />
<div className="guide">{shownSpots.slice(0, firstSpots).map((item) => place(item))}</div>
<div className="guide guide--card">{shownSpots.slice(0, firstSpots).map(spot)}</div>
{shownSpots.length > firstSpots && (
<details className="fold" key={spotRange}>
<summary className="link">{shownSpots.length - firstSpots}곳 더 보기</summary>
<div className="guide">{shownSpots.slice(firstSpots).map((item) => place(item))}</div>
<div className="guide guide--card">{shownSpots.slice(firstSpots).map(spot)}</div>
</details>
)}
</section>
@@ -2,6 +2,7 @@ import {useState} from 'react';
import type {FestivalEntry} from '@o2o/shared';
import {useSite} from '@site/lib/site-context';
import {naverSearchUrl} from '@site/lib/format';
import {PhotoCard} from '../kit/Card';
import {Sheet} from '../paper/Sheet';
const SEASONS = ['봄', '여름', '가을', '겨울'];
@@ -40,15 +41,13 @@ export function Festival() {
)}
<div className="rail">
{shown.map((f) => (
<button key={f.name} type="button" className="card" onClick={() => setOpen(f)}>
{f.imageUrl ? (
<img src={f.imageUrl} alt={f.name} loading="lazy" />
) : (
<span className="noimg">{f.name}</span>
)}
<b className="nm">{f.name}</b>
<span className="ds">{[f.month, f.location].filter(Boolean).join(' · ')}</span>
</button>
<PhotoCard
key={f.name}
image={f.imageUrl}
title={f.name}
meta={[f.month, f.location].filter(Boolean).join(' · ')}
onClick={() => setOpen(f)}
/>
))}
</div>
</section>
+2 -3
View File
@@ -1,5 +1,5 @@
import {useEffect, useState} from 'react';
import {HeroCatchphrase} from '@site/sections/HeroCatchphrase';
import {HeroCatchphrase, HeroRotator} from '@site/sections/HeroCatchphrase';
import {useSite} from '@site/lib/site-context';
import {bookingActionLabel, bookingLinks, isSectionEnabled, stayBookingView} from '@site/lib/derive';
import {PlaceCategory} from '@o2o/shared';
@@ -26,7 +26,6 @@ export function Hero() {
}, 5000);
return () => window.clearInterval(timer);
}, [total]);
const fixed = narrative.tagline ?? narrative.heroSubline;
const english = place.englishName?.trim();
const locality = [place.addressLocality, place.addressRegion].find(Boolean);
const stayBooking = place.category === PlaceCategory.LODGING ? stayBookingView(payload) : null;
@@ -57,10 +56,10 @@ export function Hero() {
{english && <p className="b-hero-en">{english}</p>}
<h1 className={english ? 'b-hero-name' : 'b-hero-name b-hero-name--solo'}>{place.name}</h1>
{locality && <p className="b-hero-loc">{locality}</p>}
{fixed && <p className="b-hero-ko">{fixed}</p>}
<p className="b-hero-cp">
<HeroCatchphrase />
</p>
<HeroRotator className="b-hero-ko" />
<div className="b-hero-act">
{stayBooking ? (
<button type="button" className="btn" onClick={() => window.dispatchEvent(new Event(BOOK_EVENT))}>
@@ -345,3 +345,22 @@
.w4-boutique[data-page=story] main .b-rule{margin-left:0;margin-right:0}
.w4-boutique[data-page=story] main .shell{padding-inline:24px}
.w4-boutique[data-page=story] main #reviews{margin-top:var(--sec)}}
.w4-boutique{--kc-r:999px 999px 0 0;--kc-ar:4/3;--kc-tf:var(--mj);--kc-tw:400;--kc-ts:17px;--kc-mc:var(--rose);--kc-sub:var(--sub);--kc-soft:var(--bg2)}
.w4-boutique .rail>.kcard{flex:0 0 62%;height:auto}
.w4-boutique .guide--card{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:28px 14px}
.w4-boutique #around .guide--card{grid-template-columns:repeat(3,minmax(0,1fr));gap:20px 10px}
.w4-boutique #around .kcard-t{font-size:15px}
@media (min-width:1024px){.w4-boutique .rail>.kcard{flex-basis:calc((100% - 48px) / 3)}.w4-boutique .guide--card{grid-template-columns:repeat(3,minmax(0,1fr));gap:36px 24px}}
@media (max-width:1023px){
.w4-boutique{--aw:min(250px,calc(100vw - 88px));--ah:calc(var(--aw) * 1.12)}
.w4-boutique[data-page=home] .b-hd:not(.solid){color:var(--brown)}
.w4-boutique .b-hero{height:auto;min-height:0;padding:calc(84px + var(--ah) + 24px) var(--g) 8px;background:transparent;overflow:visible}
.w4-boutique .b-hero:before{content:"";position:absolute;top:100px;left:50%;width:var(--aw);height:var(--ah);margin-left:calc(var(--aw) / -2 + 14px);border-radius:999px 999px 0 0;background:var(--bg2)}
.w4-boutique .b-hero:after{display:none}
.w4-boutique .b-slide{inset:84px auto auto 50%;width:var(--aw);height:var(--ah);margin-left:calc(var(--aw) / -2);border-radius:999px 999px 0 0;overflow:hidden;z-index:1}
.w4-boutique .b-hero-copy{position:relative;left:auto;right:auto;bottom:auto;padding:0;color:var(--brown)}
.w4-boutique .b-hero-ko{color:var(--ink)}
.w4-boutique .b-hero-count{top:calc(84px + var(--ah) - 34px);bottom:auto}
.w4-boutique .b-hero--plain{padding-top:120px}
.w4-boutique .b-hero--plain:before{display:none}
}
+21 -7
View File
@@ -2,6 +2,7 @@ import {useState} from 'react';
import type {LocalPlace} from '@o2o/shared';
import {useSite} from '@site/lib/site-context';
import {naverMapSearchUrl} from '@site/lib/format';
import {PhotoCard} from '../kit/Card';
import {Sheet} from '../paper/Sheet';
import {useWide} from './useWide';
@@ -71,6 +72,17 @@ export function Around() {
</button>
);
const spot = (item: LocalPlace) => (
<PhotoCard
key={item.name}
image={item.imageUrl}
title={item.name}
meta={item.distanceText}
desc={item.description}
onClick={() => setOpen(item)}
/>
);
return (
<>
{rail.length > 0 && (
@@ -81,11 +93,13 @@ export function Around() {
<p className="lead">걸어서 닿는 명소와 맛집입니다.</p>
<div className="grid3">
{rail.slice(0, HOME_ROWS).map((item) => (
<button key={item.name} type="button" className="card" onClick={() => setOpen(item)}>
<img src={item.imageUrl} alt={item.name} loading="lazy" />
<b className="nm clamp">{item.name}</b>
{item.distanceText && <span className="ds">{item.distanceText}</span>}
</button>
<PhotoCard
key={item.name}
image={item.imageUrl}
title={item.name}
meta={item.distanceText}
onClick={() => setOpen(item)}
/>
))}
</div>
<a className="link more" href="#/area">
@@ -104,11 +118,11 @@ export function Around() {
</h2>
<p className="lead">걸어서 닿는 곳부터 차로 가는 곳까지 묶었습니다.</p>
<RangeTabs places={spots} value={spotRange} onChange={setSpotRange} />
<div className="guide">{shownSpots.slice(0, firstSpots).map((item) => place(item))}</div>
<div className="guide guide--card">{shownSpots.slice(0, firstSpots).map(spot)}</div>
{shownSpots.length > firstSpots && (
<details className="fold">
<summary className="link">{shownSpots.length - firstSpots}곳 더 보기</summary>
<div className="guide">{shownSpots.slice(firstSpots).map((item) => place(item))}</div>
<div className="guide guide--card">{shownSpots.slice(firstSpots).map(spot)}</div>
</details>
)}
</section>
@@ -2,6 +2,7 @@ import {useState} from 'react';
import type {FestivalEntry} from '@o2o/shared';
import {useSite} from '@site/lib/site-context';
import {naverSearchUrl} from '@site/lib/format';
import {PhotoCard} from '../kit/Card';
import {Sheet} from '../paper/Sheet';
const SEASONS = ['봄', '여름', '가을', '겨울'];
@@ -40,15 +41,13 @@ export function Festival() {
)}
<div className="rail">
{shown.map((f) => (
<button key={f.name} type="button" className="card" onClick={() => setOpen(f)}>
{f.imageUrl ? (
<img src={f.imageUrl} alt={f.name} loading="lazy" />
) : (
<span className="noimg">{f.name}</span>
)}
<b className="nm">{f.name}</b>
<span className="ds">{[f.month, f.location].filter(Boolean).join(' · ')}</span>
</button>
<PhotoCard
key={f.name}
image={f.imageUrl}
title={f.name}
meta={[f.month, f.location].filter(Boolean).join(' · ')}
onClick={() => setOpen(f)}
/>
))}
</div>
</section>
+3 -2
View File
@@ -1,5 +1,5 @@
import {PlaceCategory} from '@o2o/shared';
import {HeroCatchphrase} from '@site/sections/HeroCatchphrase';
import {HeroCatchphrase, HeroRotator} from '@site/sections/HeroCatchphrase';
import {useSite} from '@site/lib/site-context';
import {galleryImages, isSectionEnabled} from '@site/lib/derive';
import {useLiveWeather} from '@site/lib/use-live-weather';
@@ -56,7 +56,8 @@ export function Hero() {
<HeroCatchphrase />
</p>
<h1 className="nm">{place.name}</h1>
{sub && <p className="sub">{sub}</p>}
{where && <p className="sub">{where}</p>}
<HeroRotator className="sub" />
</>
) : (
<>
@@ -296,3 +296,9 @@
.w4-cinema .unit .btns{grid-template-columns:1fr 1fr}}
.w4-cinema .wrap>.label:has(+h2),.w4-cinema .book .label,.w4-cinema .rhead>.kicker{display:none}
.w4-cinema :is(h1,h2,.big,.hl){font-family:var(--tpl-font-heading)}
.w4-cinema{--kc-r:14px;--kc-tw:600;--kc-mc:var(--accent);--kc-sub:var(--sub);--kc-soft:rgba(244,239,230,.06)}
.w4-cinema .rail>.kcard{flex:0 0 72%;height:auto}
.w4-cinema .guide--card{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:24px 14px;border-top:0}
.w4-cinema .grid3:has(>.kcard){gap:20px 10px}
.w4-cinema .grid3>.kcard .kcard-t{font-size:15px}
@media (min-width:1024px){.w4-cinema .rail>.kcard{flex:0 0 calc((100% - 30px) / 4)}.w4-cinema .guide--card,.w4-cinema #walk .guide{grid-template-columns:repeat(4,minmax(0,1fr));gap:32px 16px}.w4-cinema #around .grid3:has(>.kcard){grid-template-columns:repeat(3,minmax(0,1fr));gap:16px}}
+16 -21
View File
@@ -2,6 +2,7 @@ import {useState} from 'react';
import type {LocalPlace} from '@o2o/shared';
import {useSite} from '@site/lib/site-context';
import {naverMapSearchUrl} from '@site/lib/format';
import {PhotoCard} from '../kit/Card';
import {Sheet} from '../paper/Sheet';
import {useWide} from './useWide';
@@ -66,18 +67,14 @@ export function Around() {
);
const card = (place: LocalPlace) => (
<button key={place.name} type="button" className="place" onClick={() => setOpen(place)}>
{place.imageUrl && (
<div className="ph">
<img src={place.imageUrl} alt={place.name} loading="lazy" />
</div>
)}
<div className="bd">
<h3>{place.name}</h3>
{place.distanceText && <small>{place.distanceText}</small>}
{place.description && <p className="clamp">{place.description}</p>}
</div>
</button>
<PhotoCard
key={place.name}
image={place.imageUrl}
title={place.name}
meta={place.distanceText}
desc={place.description}
onClick={() => setOpen(place)}
/>
);
return (
@@ -94,15 +91,13 @@ export function Around() {
</div>
<div className="guide guide--3">
{rail.slice(0, railMax).map((place) => (
<button key={place.name} type="button" className="place" onClick={() => setOpen(place)}>
<div className="ph">
<img src={place.imageUrl} alt={place.name} loading="lazy" />
</div>
<div className="bd">
<h3>{place.name}</h3>
{place.distanceText && <small>{place.distanceText}</small>}
</div>
</button>
<PhotoCard
key={place.name}
image={place.imageUrl}
title={place.name}
meta={place.distanceText}
onClick={() => setOpen(place)}
/>
))}
</div>
<a href="#/area" className="more">
+3 -13
View File
@@ -1,7 +1,7 @@
import {PlaceCategory} from '@o2o/shared';
import {HeroCatchphrase} from '@site/sections/HeroCatchphrase';
import {HeroCatchphrase, HeroRotator} from '@site/sections/HeroCatchphrase';
import {useSite} from '@site/lib/site-context';
import {bookingActionLabel, bookingLinks, heroFacts, isSectionEnabled, stayBookingView} from '@site/lib/derive';
import {bookingActionLabel, bookingLinks, isSectionEnabled, stayBookingView} from '@site/lib/derive';
import {Car} from '../paper/Car';
import {BOOK_EVENT} from '../paper/Rooms';
import {Weather} from './Weather';
@@ -20,7 +20,6 @@ export function Hero() {
const region = place.addressLocality ?? place.addressRegion;
const booking = bookingLinks(payload)[0];
const stay = lodging ? stayBookingView(payload) : null;
const chips = heroFacts(payload).map((row) => `${row.label} ${row.value}`);
return (
<>
@@ -56,16 +55,7 @@ export function Hero() {
) : (
fixed && <p className="hl in">{fixed}</p>
)}
{lodging && fixed && <p className="tagline">{fixed}</p>}
{chips.length > 0 && (
<div className="chips">
{chips.map((chip) => (
<span key={chip} className="chip">
{chip}
</span>
))}
</div>
)}
<HeroRotator className="tagline" />
<div className="hero-cta">
{stay ? (
<button type="button" className="btn" onClick={() => window.dispatchEvent(new Event(BOOK_EVENT))}>
+2 -13
View File
@@ -12,20 +12,9 @@ const MOOD_ICON = {
눈: SnowIcon,
} as const;
const OBSERVED = new Intl.DateTimeFormat('ko-KR', {
timeZone: 'Asia/Seoul',
month: 'long',
day: 'numeric',
hour: '2-digit',
minute: '2-digit',
hourCycle: 'h23',
});
function observed(iso: string): string | undefined {
const date = new Date(iso);
if (Number.isNaN(date.getTime())) return undefined;
const parts = Object.fromEntries(OBSERVED.formatToParts(date).map((p) => [p.type, p.value]));
return `${parts.month} ${parts.day}일 ${parts.hour}:${parts.minute} 관측`;
const m = /^\d{4}-(\d{2})-(\d{2})T(\d{2}):(\d{2})/.exec(iso);
return m ? `${Number(m[1])}월 ${Number(m[2])}일 ${m[3]}:${m[4]} 관측` : undefined;
}
export function Weather() {
@@ -447,3 +447,5 @@
.w4-coral #about .amen li.off .ic{color:#c2410c}
.w4-coral #about .amen li.off{color:var(--sub)}
.w4-coral :is(h1,h2,h3){font-family:var(--tpl-font-heading)}
.w4-coral{--kc-r:0;--kc-tw:500;--kc-mc:var(--accent);--kc-sub:var(--sub);--kc-soft:var(--alt)}
.w4-coral .cards2,.w4-coral .guide--3{row-gap:24px}
+15 -2
View File
@@ -2,6 +2,7 @@ import {useState} from 'react';
import type {LocalPlace} from '@o2o/shared';
import {useSite} from '@site/lib/site-context';
import {naverMapSearchUrl} from '@site/lib/format';
import {PhotoCard} from '../kit/Card';
import {Sheet} from '../paper/Sheet';
import {SpotIcon} from './Art';
import {useWide} from './useWide';
@@ -70,6 +71,18 @@ export function Around() {
</button>
);
const spot = (place: LocalPlace) => (
<PhotoCard
key={place.name}
image={place.imageUrl}
title={place.name}
meta={place.distanceText}
desc={place.description}
fallback={<SpotIcon food={false} />}
onClick={() => setOpen(place)}
/>
);
return (
<>
<div data-pg="home">
@@ -103,11 +116,11 @@ export function Around() {
const shown = spots.filter((p) => inRange(spotRange)(meters(p)));
return (
<>
<div className="guide guide--card">{shown.slice(0, firstSpots).map((p, i) => row(p, i))}</div>
<div className="guide guide--card">{shown.slice(0, firstSpots).map(spot)}</div>
{shown.length > firstSpots && (
<details>
<summary className="more">{shown.length - firstSpots}곳 더 보기</summary>
<div className="guide guide--card">{shown.slice(firstSpots).map((p, i) => row(p, i + firstSpots))}</div>
<div className="guide guide--card">{shown.slice(firstSpots).map(spot)}</div>
</details>
)}
</>
@@ -2,6 +2,7 @@ import {useState} from 'react';
import type {FestivalEntry} from '@o2o/shared';
import {useSite} from '@site/lib/site-context';
import {naverSearchUrl} from '@site/lib/format';
import {PhotoCard} from '../kit/Card';
import {Sheet} from '../paper/Sheet';
const SEASONS = ['봄', '여름', '가을', '겨울'];
@@ -40,15 +41,13 @@ export function Festival() {
)}
<div className="rail">
{shown.map((f) => (
<button key={f.name} type="button" className="card" onClick={() => setOpen(f)}>
{f.imageUrl ? (
<img src={f.imageUrl} alt={f.name} loading="lazy" />
) : (
<span className="noimg">{f.name}</span>
)}
<b className="nm">{f.name}</b>
<span className="ds">{[f.month, f.location].filter(Boolean).join(' · ')}</span>
</button>
<PhotoCard
key={f.name}
image={f.imageUrl}
title={f.name}
meta={[f.month, f.location].filter(Boolean).join(' · ')}
onClick={() => setOpen(f)}
/>
))}
</div>
</section>
+3 -26
View File
@@ -1,15 +1,14 @@
import {useEffect, useState, type CSSProperties} from 'react';
import {PlaceCategory, type WeatherSky} from '@o2o/shared';
import {useSite} from '@site/lib/site-context';
import {HeroRotator, useMainCatchphrase} from '@site/sections/HeroCatchphrase';
import {useLiveWeather} from '@site/lib/use-live-weather';
import {useWeatherNotes} from '@site/lib/use-weather-note';
import {bookingActionLabel, bookingLinks, isSectionEnabled, stayBookingView, weatherBand, weatherMood} from '@site/lib/derive';
import {BOOK_EVENT} from '../paper/Rooms';
import lines from '@site/lib/lodging-catchphrases.json';
import {Hills, Sky} from './Art';
const STEP_MS = 35;
const ROTATE_MS = 4500;
export function Pop({text}: {text: string}) {
const words = text.split(/\s+/).map((word) => [...word]);
@@ -32,26 +31,6 @@ export function Pop({text}: {text: string}) {
);
}
function useCatchphrase(): string | undefined {
const {place, narrative} = useSite();
const lodging = place.category === PlaceCategory.LODGING;
const own = (narrative.catchphrases?.items ?? [])
.filter((item) => (item.kind ?? 'general') === 'general')
.map((item) => item.text.trim())
.filter(Boolean);
const phrases = own.length > 0 ? own : lodging ? lines : [];
const [index, setIndex] = useState(0);
useEffect(() => {
if (phrases.length < 2) return;
const motion = window.matchMedia('(prefers-reduced-motion: reduce)');
const timer = window.setInterval(() => {
if (!document.hidden && !motion.matches) setIndex((value) => (value + 1) % phrases.length);
}, ROTATE_MS);
return () => window.clearInterval(timer);
}, [phrases.length]);
return phrases.length > 0 ? phrases[index % phrases.length] : undefined;
}
function WeatherCard() {
const payload = useSite();
const weather = useLiveWeather({
@@ -101,9 +80,8 @@ function WeatherCard() {
export function Hero() {
const payload = useSite();
const {place, narrative} = payload;
const phrase = useCatchphrase();
const phrase = useMainCatchphrase();
const region = [place.addressRegion, place.addressLocality].filter(Boolean).join(' ');
const fixed = narrative.tagline ?? narrative.heroSubline;
const stay = place.category === PlaceCategory.LODGING ? stayBookingView(payload) : null;
const link = bookingLinks(payload)[0];
@@ -111,7 +89,6 @@ export function Hero() {
<section className="scene" id="top" data-pg="home" aria-labelledby="hero-heading">
<Sky />
<div className="hero-copy">
{region && <span className="tag">{region}</span>}
<h1 id="hero-heading" className="disp">
<Pop text={place.name} />
</h1>
@@ -120,7 +97,7 @@ export function Hero() {
<Pop text={phrase} />
</p>
)}
{fixed && <p className="sub">{fixed}</p>}
<HeroRotator className="sub" />
{(stay || link || place.phone) && (
<div className="hgo">
{stay ? (
@@ -334,3 +334,7 @@
@media(max-width:1023px){.w4-graphic #location .btns{display:grid;grid-template-columns:1fr 1fr;gap:8px}
.w4-graphic #location .btns>:first-child{grid-column:1/-1}
.w4-graphic #location .btns>*{white-space:nowrap;min-width:0}}
.w4-graphic{--kc-r:0;--kc-box-r:22px;--kc-bg:var(--card);--kc-shadow:0 2px 0 rgba(29,43,36,.08);--kc-px:12px;--kc-pb:14px;--kc-tf:var(--k-head);--kc-tw:400;--kc-ts:17px;--kc-mc:var(--accent);--kc-sub:var(--sub);--kc-soft:#fff1c9}
.w4-graphic .rail>.kcard{flex:0 0 72%;height:auto}
.w4-graphic .guide--card{grid-template-columns:repeat(2,minmax(0,1fr));gap:24px 14px}
@media (min-width:1024px){.w4-graphic .rail>.kcard{flex:0 0 calc((100% - 48px) / 4)}.w4-graphic .guide--card{grid-template-columns:repeat(4,minmax(0,1fr));gap:32px 16px}}
+31
View File
@@ -0,0 +1,31 @@
import type {ReactNode} from 'react';
import './card.css';
export function PhotoCard({
image,
title,
meta,
desc,
fallback,
ratio,
onClick,
}: {
image?: string | null;
title: string;
meta?: string | null;
desc?: string | null;
fallback?: ReactNode;
ratio?: string;
onClick: () => void;
}) {
return (
<button type="button" className="kcard" onClick={onClick}>
<span className="kcard-ph" style={ratio ? {aspectRatio: ratio} : undefined}>
{image ? <img src={image} alt={title} loading="lazy" /> : <span className="kcard-no">{fallback ?? title}</span>}
</span>
<span className="kcard-t">{title}</span>
{meta && <span className="kcard-m">{meta}</span>}
{desc && <span className="kcard-d">{desc}</span>}
</button>
);
}
+13
View File
@@ -0,0 +1,13 @@
:is(.w4p,.w4-round,.w4-cinema,.w4-bigtype,.w4-boutique,.w4-graphic,.w4-coral,.w4-minimal,.w4-pine) .kcard{display:flex;flex-direction:column;width:100%;height:100%;min-width:0;margin:0;padding:0 0 var(--kc-pb,0);border:0;border-radius:var(--kc-box-r,0);overflow:hidden;background:var(--kc-bg,none);box-shadow:var(--kc-shadow,none);color:inherit;font:inherit;text-align:left;cursor:pointer;-webkit-appearance:none;appearance:none}
:is(.w4p,.w4-round,.w4-cinema,.w4-bigtype,.w4-boutique,.w4-graphic,.w4-coral,.w4-minimal,.w4-pine) .kcard-ph{position:relative;display:block;width:100%;aspect-ratio:var(--kc-ar,3/2);border-radius:var(--kc-r,14px);overflow:hidden;background:var(--kc-soft,rgba(127,127,127,.1))}
:is(.w4p,.w4-round,.w4-cinema,.w4-bigtype,.w4-boutique,.w4-graphic,.w4-coral,.w4-minimal,.w4-pine) .kcard-ph img{display:block;width:100%;height:100%;object-fit:cover;transition:transform .5s ease}
:is(.w4p,.w4-round,.w4-cinema,.w4-bigtype,.w4-boutique,.w4-graphic,.w4-coral,.w4-minimal,.w4-pine) .kcard:hover .kcard-ph img{transform:scale(1.03)}
:is(.w4p,.w4-round,.w4-cinema,.w4-bigtype,.w4-boutique,.w4-graphic,.w4-coral,.w4-minimal,.w4-pine) .kcard-no{display:grid;place-items:center;width:100%;height:100%;padding:0 16px;font-family:var(--kc-tf,inherit);font-size:17px;line-height:1.4;text-align:center;color:var(--kc-sub,inherit)}
:is(.w4p,.w4-round,.w4-cinema,.w4-bigtype,.w4-boutique,.w4-graphic,.w4-coral,.w4-minimal,.w4-pine) .kcard-no svg{width:40px;height:40px}
:is(.w4p,.w4-round,.w4-cinema,.w4-bigtype,.w4-boutique,.w4-graphic,.w4-coral,.w4-minimal,.w4-pine) .kcard-t{display:-webkit-box;-webkit-line-clamp:1;-webkit-box-orient:vertical;overflow:hidden;margin-top:12px;padding:0 var(--kc-px,2px);font-family:var(--kc-tf,inherit);font-size:var(--kc-ts,16px);font-weight:var(--kc-tw,600);line-height:1.45;letter-spacing:-.01em}
:is(.w4p,.w4-round,.w4-cinema,.w4-bigtype,.w4-boutique,.w4-graphic,.w4-coral,.w4-minimal,.w4-pine) .kcard-m{display:-webkit-box;-webkit-line-clamp:1;-webkit-box-orient:vertical;overflow:hidden;margin-top:4px;padding:0 var(--kc-px,2px);font-size:14px;font-weight:500;line-height:1.5;color:var(--kc-mc,inherit)}
:is(.w4p,.w4-round,.w4-cinema,.w4-bigtype,.w4-boutique,.w4-graphic,.w4-coral,.w4-minimal,.w4-pine) .kcard-d{display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden;margin-top:6px;padding:0 var(--kc-px,2px);font-size:15px;line-height:1.6;color:var(--kc-sub,inherit)}
:is(.w4p,.w4-round,.w4-cinema,.w4-bigtype,.w4-boutique,.w4-graphic,.w4-coral,.w4-minimal,.w4-pine) .kgrid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:24px 14px}
@media (min-width:1024px){:is(.w4p,.w4-round,.w4-cinema,.w4-bigtype,.w4-boutique,.w4-graphic,.w4-coral,.w4-minimal,.w4-pine) .kgrid{grid-template-columns:repeat(auto-fill,minmax(220px,1fr));gap:32px 20px}}
:is(.w4p,.w4-round,.w4-cinema,.w4-bigtype,.w4-boutique,.w4-graphic,.w4-coral,.w4-minimal,.w4-pine) .car--multi:has(.kcard) .arrow{top:calc(50% - 30px)}
@media (max-width:1023px){:is(.w4p,.w4-round,.w4-cinema,.w4-bigtype,.w4-boutique,.w4-graphic,.w4-coral,.w4-minimal,.w4-pine) .car--multi:has(.kcard) .arrow{display:none}}
+5 -5
View File
@@ -1,8 +1,8 @@
:is(.w4-round,.w4-cinema,.w4-bigtype,.w4-boutique,.w4-graphic,.w4-coral,.w4-minimal,.w4-pine){--k-pad:20px;--k-wide:640px;--k-r:12px;--k-soft:rgba(127,127,127,.08);--k-line:rgba(127,127,127,.22);--k-head:inherit}
:is(.w4-round,.w4-cinema,.w4-bigtype,.w4-boutique,.w4-graphic,.w4-coral,.w4-minimal,.w4-pine) *{box-sizing:border-box}
:is(.w4-round,.w4-cinema,.w4-bigtype,.w4-boutique,.w4-graphic,.w4-coral,.w4-minimal,.w4-pine) .sbox{border-radius:20px 20px 0 0}
:is(.w4-round,.w4-cinema,.w4-bigtype,.w4-boutique,.w4-graphic,.w4-coral,.w4-minimal,.w4-pine) .sform{padding:22px var(--k-pad) 8px}
:is(.w4-round,.w4-cinema,.w4-bigtype,.w4-boutique,.w4-graphic,.w4-coral,.w4-minimal,.w4-pine) .sform h3{margin:0 0 16px;font-family:var(--k-head);font-size:21px;font-weight:600}
:is(.w4-round,.w4-cinema,.w4-bigtype,.w4-boutique,.w4-graphic,.w4-coral,.w4-minimal,.w4-pine) .sbox{border-radius:var(--k-r)}
:is(.w4-round,.w4-cinema,.w4-bigtype,.w4-boutique,.w4-graphic,.w4-coral,.w4-minimal,.w4-pine) :is(.sform,.sheetbody){padding:22px var(--k-pad) 8px}
:is(.w4-round,.w4-cinema,.w4-bigtype,.w4-boutique,.w4-graphic,.w4-coral,.w4-minimal,.w4-pine) :is(.sform,.sheetbody) h3{margin:0 0 16px;font-family:var(--k-head);font-size:21px;font-weight:600}
:is(.w4-round,.w4-cinema,.w4-bigtype,.w4-boutique,.w4-graphic,.w4-coral,.w4-minimal,.w4-pine) .sheet .cta,:is(.w4-round,.w4-cinema,.w4-bigtype,.w4-boutique,.w4-graphic,.w4-coral,.w4-minimal,.w4-pine) .sform button.cta{display:flex;align-items:center;justify-content:center;width:100%;height:52px;border:0;border-radius:var(--k-r);background:var(--k-ink);color:var(--k-bg);font:inherit;font-size:16px;font-weight:700;cursor:pointer}
:is(.w4-round,.w4-cinema,.w4-bigtype,.w4-boutique,.w4-graphic,.w4-coral,.w4-minimal,.w4-pine) .sform input,:is(.w4-round,.w4-cinema,.w4-bigtype,.w4-boutique,.w4-graphic,.w4-coral,.w4-minimal,.w4-pine) .sform textarea{width:100%;padding:12px 14px;border:1px solid var(--k-line);border-radius:var(--k-r);background:transparent;color:var(--k-ink);font:inherit;font-size:16px}
:is(.w4-round,.w4-cinema,.w4-bigtype,.w4-boutique,.w4-graphic,.w4-coral,.w4-minimal,.w4-pine) .car{position:relative}
@@ -48,10 +48,10 @@
:is(.w4-round,.w4-cinema,.w4-bigtype,.w4-boutique,.w4-graphic,.w4-coral,.w4-minimal,.w4-pine) .car .dots button.on{width:18px;border-radius:999px;background:var(--k-ink)}
:is(.w4-round,.w4-cinema,.w4-bigtype,.w4-boutique,.w4-graphic,.w4-coral,.w4-minimal,.w4-pine) details>summary{list-style:none;cursor:pointer}
:is(.w4-round,.w4-cinema,.w4-bigtype,.w4-boutique,.w4-graphic,.w4-coral,.w4-minimal,.w4-pine) details>summary::-webkit-details-marker{display:none}
:is(.w4-round,.w4-cinema,.w4-bigtype,.w4-boutique,.w4-graphic,.w4-coral,.w4-minimal,.w4-pine) .sheet{position:fixed;inset:0;z-index:40}
:is(.w4-round,.w4-cinema,.w4-bigtype,.w4-boutique,.w4-graphic,.w4-coral,.w4-minimal,.w4-pine) .sheet{position:fixed;inset:0;z-index:40;display:flex;align-items:center;justify-content:center;padding:24px 16px}
:is(.w4-round,.w4-cinema,.w4-bigtype,.w4-boutique,.w4-graphic,.w4-coral,.w4-minimal,.w4-pine) .sheet[hidden]{display:none}
:is(.w4-round,.w4-cinema,.w4-bigtype,.w4-boutique,.w4-graphic,.w4-coral,.w4-minimal,.w4-pine) .sbg{position:absolute;inset:0;background:rgba(14,13,10,.52)}
:is(.w4-round,.w4-cinema,.w4-bigtype,.w4-boutique,.w4-graphic,.w4-coral,.w4-minimal,.w4-pine) .sbox{position:absolute;left:0;right:0;bottom:0;max-width:var(--k-wide);margin:0 auto; max-height:88svh;overflow:auto;background:var(--k-bg);padding:0 0 32px; -webkit-overflow-scrolling:touch}
:is(.w4-round,.w4-cinema,.w4-bigtype,.w4-boutique,.w4-graphic,.w4-coral,.w4-minimal,.w4-pine) .sbox{position:relative;width:100%;max-width:560px;margin:0 auto; max-height:calc(100svh - 48px);overflow:auto;background:var(--k-bg);padding:0 0 32px; -webkit-overflow-scrolling:touch}
:is(.w4-round,.w4-cinema,.w4-bigtype,.w4-boutique,.w4-graphic,.w4-coral,.w4-minimal,.w4-pine) .sx{position:sticky;top:0;float:right;width:48px;height:48px;border:0;background:none; font-size:22px;line-height:1;color:var(--k-ink);cursor:pointer;z-index:1}
:is(.w4-round,.w4-cinema,.w4-bigtype,.w4-boutique,.w4-graphic,.w4-coral,.w4-minimal,.w4-pine) .sin{padding-top:16px}
:is(.w4-round,.w4-cinema,.w4-bigtype,.w4-boutique,.w4-graphic,.w4-coral,.w4-minimal,.w4-pine) .sin img{margin:0 0 18px}
+16 -21
View File
@@ -2,6 +2,7 @@ import {useState} from 'react';
import type {LocalPlace} from '@o2o/shared';
import {useSite} from '@site/lib/site-context';
import {naverMapSearchUrl} from '@site/lib/format';
import {PhotoCard} from '../kit/Card';
import {Sheet} from '../paper/Sheet';
import {useWide} from './useWide';
@@ -66,18 +67,14 @@ export function Around() {
);
const card = (place: LocalPlace) => (
<button key={place.name} type="button" className="place" onClick={() => setOpen(place)}>
{place.imageUrl && (
<div className="ph">
<img src={place.imageUrl} alt={place.name} loading="lazy" />
</div>
)}
<div className="bd">
<h3>{place.name}</h3>
{place.distanceText && <small>{place.distanceText}</small>}
{place.description && <p className="clamp">{place.description}</p>}
</div>
</button>
<PhotoCard
key={place.name}
image={place.imageUrl}
title={place.name}
meta={place.distanceText}
desc={place.description}
onClick={() => setOpen(place)}
/>
);
return (
@@ -94,15 +91,13 @@ export function Around() {
</div>
<div className="guide guide--3">
{rail.slice(0, railMax).map((place) => (
<button key={place.name} type="button" className="place" onClick={() => setOpen(place)}>
<div className="ph">
<img src={place.imageUrl} alt={place.name} loading="lazy" />
</div>
<div className="bd">
<h3>{place.name}</h3>
{place.distanceText && <small>{place.distanceText}</small>}
</div>
</button>
<PhotoCard
key={place.name}
image={place.imageUrl}
title={place.name}
meta={place.distanceText}
onClick={() => setOpen(place)}
/>
))}
</div>
<a href="#/area" className="more">
+3 -13
View File
@@ -1,7 +1,7 @@
import {PlaceCategory} from '@o2o/shared';
import {HeroCatchphrase} from '@site/sections/HeroCatchphrase';
import {HeroCatchphrase, HeroRotator} from '@site/sections/HeroCatchphrase';
import {useSite} from '@site/lib/site-context';
import {bookingActionLabel, bookingLinks, heroFacts, isSectionEnabled, stayBookingView} from '@site/lib/derive';
import {bookingActionLabel, bookingLinks, isSectionEnabled, stayBookingView} from '@site/lib/derive';
import {Car} from '../paper/Car';
import {BOOK_EVENT} from '../paper/Rooms';
import {Weather} from './Weather';
@@ -20,7 +20,6 @@ export function Hero() {
const region = place.addressLocality ?? place.addressRegion;
const booking = bookingLinks(payload)[0];
const stay = lodging ? stayBookingView(payload) : null;
const chips = heroFacts(payload).map((row) => `${row.label} ${row.value}`);
return (
<>
@@ -56,16 +55,7 @@ export function Hero() {
) : (
fixed && <p className="hl in">{fixed}</p>
)}
{lodging && fixed && <p className="tagline">{fixed}</p>}
{chips.length > 0 && (
<div className="chips">
{chips.map((chip) => (
<span key={chip} className="chip">
{chip}
</span>
))}
</div>
)}
<HeroRotator className="tagline" />
<div className="hero-cta">
{stay ? (
<button type="button" className="btn" onClick={() => window.dispatchEvent(new Event(BOOK_EVENT))}>
+2 -13
View File
@@ -12,20 +12,9 @@ const MOOD_ICON = {
눈: SnowIcon,
} as const;
const OBSERVED = new Intl.DateTimeFormat('ko-KR', {
timeZone: 'Asia/Seoul',
month: 'long',
day: 'numeric',
hour: '2-digit',
minute: '2-digit',
hourCycle: 'h23',
});
function observed(iso: string): string | undefined {
const date = new Date(iso);
if (Number.isNaN(date.getTime())) return undefined;
const parts = Object.fromEntries(OBSERVED.formatToParts(date).map((p) => [p.type, p.value]));
return `${parts.month} ${parts.day}일 ${parts.hour}:${parts.minute} 관측`;
const m = /^\d{4}-(\d{2})-(\d{2})T(\d{2}):(\d{2})/.exec(iso);
return m ? `${Number(m[1])}월 ${Number(m[2])}일 ${m[3]}:${m[4]} 관측` : undefined;
}
export function Weather() {
@@ -450,3 +450,5 @@
.w4-minimal #about .amen li.off .ic{color:#c2410c}
.w4-minimal #about .amen li.off{color:var(--sub)}
.w4-minimal :is(h1,h2,.hl){font-family:var(--tpl-font-heading)}
.w4-minimal{--kc-r:0;--kc-tw:400;--kc-mc:var(--sub);--kc-sub:var(--sub);--kc-soft:var(--alt)}
.w4-minimal .cards2,.w4-minimal .guide--3{row-gap:28px}
+11 -15
View File
@@ -2,6 +2,7 @@ import {useState} from 'react';
import type {LocalPlace} from '@o2o/shared';
import {useSite} from '@site/lib/site-context';
import {naverMapSearchUrl} from '@site/lib/format';
import {PhotoCard} from '../kit/Card';
import {Car} from './Car';
import {Sheet} from './Sheet';
@@ -80,11 +81,7 @@ export function Around() {
arrows
label="주변 안내"
slides={rail.map((place) => (
<button type="button" className="itemcard" onClick={() => setOpen(place)}>
<img src={place.imageUrl} alt={place.name} loading="lazy" style={{aspectRatio: '3 / 2'}} />
<p className="cap">{place.name}</p>
{place.distanceText && <p className="cap dim">{place.distanceText}</p>}
</button>
<PhotoCard image={place.imageUrl} title={place.name} meta={place.distanceText} onClick={() => setOpen(place)} />
))}
/>
</section>
@@ -104,17 +101,16 @@ export function Around() {
걸어서 닿는 곳부터 차로 가는 곳까지 묶었습니다.
</p>
<RangeTabs places={spots} value={spotRange} onChange={setSpotRange} />
<div className="grid2" style={{gap: 14}}>
<div className="grid2" style={{gap: '24px 14px'}}>
{shownSpots.map((place) => (
<button key={place.name} type="button" className="itemcard" onClick={() => setOpen(place)}>
{place.imageUrl && (
<img src={place.imageUrl} alt={place.name} loading="lazy" style={{aspectRatio: '3 / 2'}} />
)}
<p className="cap">
<b>{place.name}</b> {place.distanceText && <span className="dim">{place.distanceText}</span>}
</p>
{place.description && <p className="cap dim clamp">{place.description}</p>}
</button>
<PhotoCard
key={place.name}
image={place.imageUrl}
title={place.name}
meta={place.distanceText}
desc={place.description}
onClick={() => setOpen(place)}
/>
))}
</div>
</section>
+7 -13
View File
@@ -2,6 +2,7 @@ import {useState} from 'react';
import type {FestivalEntry} from '@o2o/shared';
import {useSite} from '@site/lib/site-context';
import {naverSearchUrl} from '@site/lib/format';
import {PhotoCard} from '../kit/Card';
import {Car} from './Car';
import {Sheet} from './Sheet';
@@ -48,19 +49,12 @@ export function Festival() {
arrows
label="계절별 축제"
slides={shown.map((f) => (
<button type="button" className="itemcard" onClick={() => setOpen(f)}>
{f.imageUrl ? (
<img src={f.imageUrl} alt={f.name} loading="lazy" style={{aspectRatio: '3 / 2'}} />
) : (
<span className="noimg" style={{aspectRatio: '3 / 2'}}>
{f.name}
</span>
)}
<p className="cap">
<b>{f.name}</b>
</p>
<p className="cap dim">{[f.month, f.location].filter(Boolean).join(' · ')}</p>
</button>
<PhotoCard
image={f.imageUrl}
title={f.name}
meta={[f.month, f.location].filter(Boolean).join(' · ')}
onClick={() => setOpen(f)}
/>
))}
/>
</section>
+2 -3
View File
@@ -1,4 +1,4 @@
import {HeroCatchphrase} from '@site/sections/HeroCatchphrase';
import {HeroCatchphrase, HeroRotator} from '@site/sections/HeroCatchphrase';
import {useSite} from '@site/lib/site-context';
import {isSectionEnabled} from '@site/lib/derive';
import {Weather} from './Weather';
@@ -13,7 +13,6 @@ export function Hero() {
.filter((image) => image.alt?.trim())
.sort((a, b) => Number(b.isPrimary) - Number(a.isPrimary))
.slice(0, MAX_SLIDES);
const fixed = narrative.tagline ?? narrative.heroSubline;
return (
<>
@@ -41,10 +40,10 @@ export function Hero() {
<p className="eyebrow">{place.addressLocality ?? place.addressRegion}</p>
)}
<h1 className="mj">{place.name}</h1>
{fixed && <p className="tagline">{fixed}</p>}
<p className="cp">
<HeroCatchphrase />
</p>
<HeroRotator className="tagline" />
</div>
</section>
{isSectionEnabled(payload, 'weather') && (
+30 -21
View File
@@ -2,6 +2,7 @@ import {useState, type ReactNode} from 'react';
import type {ChronicleItem, PeopleItem, ReadingItem, SongItem} from '@o2o/shared';
import {useSite} from '@site/lib/site-context';
import {sectionItems, sectionName} from '@site/lib/derive';
import {PhotoCard} from '../kit/Card';
import {Sheet} from './Sheet';
const COUNT_WORD: Record<number, string> = {1: '한', 2: '두', 3: '세', 4: '네'};
@@ -60,27 +61,35 @@ export function Story() {
{item.year && <span className="r">{item.year}</span>}
</button>
);
const person = (item: PeopleItem) => (
<button
key={item.name}
type="button"
className="itemcard"
onClick={() =>
setOpen({
title: item.name,
meta: [item.role, item.years].filter(Boolean).join(' · '),
body: item.oneLine,
image: item.imageUrl,
})
}
>
{item.imageUrl && <img src={item.imageUrl} alt={item.name} loading="lazy" style={{aspectRatio: '1 / 1'}} />}
<p className="cap">
<b>{item.name}</b> {item.role && <span className="dim">{item.role}</span>}
</p>
{item.oneLine && <p className="cap dim clamp">{item.oneLine}</p>}
</button>
);
const person = (item: PeopleItem) => {
const show = () =>
setOpen({
title: item.name,
meta: [item.role, item.years].filter(Boolean).join(' · '),
body: item.oneLine,
image: item.imageUrl,
});
if (item.imageUrl)
return (
<PhotoCard
key={item.name}
image={item.imageUrl}
title={item.name}
meta={item.role}
desc={item.oneLine}
ratio="1 / 1"
onClick={show}
/>
);
return (
<button key={item.name} type="button" className="itemcard" onClick={show}>
<p className="cap">
<b>{item.name}</b> {item.role && <span className="dim">{item.role}</span>}
</p>
{item.oneLine && <p className="cap dim clamp">{item.oneLine}</p>}
</button>
);
};
const event = (item: ChronicleItem) => (
<button
key={`${item.year}-${item.title}`}
+3 -2
View File
@@ -255,10 +255,10 @@
@supports(padding:max(0px)){
.w4p .bar{height:calc(var(--bar) + env(safe-area-inset-bottom)); padding-bottom:calc(9px + env(safe-area-inset-bottom))}
}
.w4p .sheet{position:fixed;inset:0;z-index:40}
.w4p .sheet{position:fixed;inset:0;z-index:40;display:flex;align-items:center;justify-content:center;padding:24px 16px}
.w4p .sheet[hidden]{display:none}
.w4p .sbg{position:absolute;inset:0;background:rgba(14,13,10,.52)}
.w4p .sbox{position:absolute;left:0;right:0;bottom:0;max-width:var(--wide);margin:0 auto; max-height:88svh;overflow:auto;background:var(--paper);padding:0 0 32px; -webkit-overflow-scrolling:touch}
.w4p .sbox{position:relative;width:100%;max-width:560px;margin:0 auto; max-height:calc(100svh - 48px);border-radius:8px;overflow:auto;background:var(--paper);padding:0 0 32px; -webkit-overflow-scrolling:touch}
.w4p .sx{position:sticky;top:0;float:right;width:48px;height:48px;border:0;background:none; font-size:22px;line-height:1;color:var(--ink);cursor:pointer;z-index:1}
.w4p .sin{padding-top:16px}
.w4p .sin img{margin:0 0 18px}
@@ -338,3 +338,4 @@
.w4p #w4d-panel .w4d-eq i{background:#8c4a2f}
.w4p #w4d-lyrics-box{padding:14px 16px 18px;border-top:1px solid var(--line);font-family:'Noto Serif KR','AppleMyungjo',serif;font-size:15px;line-height:1.95;color:#39352e}
.w4p #w4d-panel .w4d-info{line-height:1.45}
.w4p{--kc-r:4px;--kc-tw:500;--kc-ts:16.5px;--kc-mc:var(--sub);--kc-sub:var(--sub);--kc-soft:var(--tint)}
+9 -12
View File
@@ -2,6 +2,7 @@ import {useState} from 'react';
import type {LocalPlace} from '@o2o/shared';
import {useSite} from '@site/lib/site-context';
import {naverMapSearchUrl} from '@site/lib/format';
import {PhotoCard} from '../kit/Card';
import {Sheet} from '../paper/Sheet';
import {useWide} from './useWide';
@@ -66,18 +67,14 @@ export function Around() {
);
const card = (place: LocalPlace) => (
<button key={place.name} type="button" className="place" onClick={() => setOpen(place)}>
{place.imageUrl && (
<div className="ph">
<img src={place.imageUrl} alt={place.name} loading="lazy" />
</div>
)}
<div className="bd">
<h3>{place.name}</h3>
{place.distanceText && <small>{place.distanceText}</small>}
{place.description && <p className="clamp">{place.description}</p>}
</div>
</button>
<PhotoCard
key={place.name}
image={place.imageUrl}
title={place.name}
meta={place.distanceText}
desc={place.description}
onClick={() => setOpen(place)}
/>
);
return (
+3 -17
View File
@@ -1,7 +1,7 @@
import {PlaceCategory} from '@o2o/shared';
import {HeroCatchphrase} from '@site/sections/HeroCatchphrase';
import {HeroCatchphrase, HeroRotator} from '@site/sections/HeroCatchphrase';
import {useSite} from '@site/lib/site-context';
import {bookingActionLabel, bookingLinks, heroFacts, isSectionEnabled, stayBookingView} from '@site/lib/derive';
import {bookingActionLabel, bookingLinks, isSectionEnabled, stayBookingView} from '@site/lib/derive';
import {Car} from '../paper/Car';
import {BOOK_EVENT} from '../paper/Rooms';
import {Weather} from './Weather';
@@ -18,13 +18,8 @@ export function Hero() {
const fixed = narrative.tagline ?? narrative.heroSubline;
const lodging = place.category === PlaceCategory.LODGING;
const region = place.addressLocality ?? place.addressRegion;
const nearest = [...payload.local.attractions]
.filter((spot) => spot.distanceText)
.sort((a, b) => (a.distanceMeters ?? Infinity) - (b.distanceMeters ?? Infinity))[0];
const sub = fixed ?? (nearest ? `${nearest.name}까지 ${nearest.distanceText}` : undefined);
const booking = bookingLinks(payload)[0];
const stay = lodging ? stayBookingView(payload) : null;
const chips = heroFacts(payload).map((row) => `${row.label} ${row.value}`);
return (
<>
@@ -60,16 +55,7 @@ export function Hero() {
) : (
fixed && <p className="hl in">{fixed}</p>
)}
{lodging && sub && <p className="tagline">{sub}</p>}
{chips.length > 0 && (
<div className="chips">
{chips.map((chip) => (
<span key={chip} className="chip">
{chip}
</span>
))}
</div>
)}
<HeroRotator className="tagline" />
<div className="hero-cta">
{stay ? (
<button type="button" className="btn" onClick={() => window.dispatchEvent(new Event(BOOK_EVENT))}>
+2 -13
View File
@@ -12,20 +12,9 @@ const MOOD_ICON = {
눈: SnowIcon,
} as const;
const OBSERVED = new Intl.DateTimeFormat('ko-KR', {
timeZone: 'Asia/Seoul',
month: 'long',
day: 'numeric',
hour: '2-digit',
minute: '2-digit',
hourCycle: 'h23',
});
function observed(iso: string): string | undefined {
const date = new Date(iso);
if (Number.isNaN(date.getTime())) return undefined;
const parts = Object.fromEntries(OBSERVED.formatToParts(date).map((p) => [p.type, p.value]));
return `${parts.month} ${parts.day}일 ${parts.hour}:${parts.minute} 관측`;
const m = /^\d{4}-(\d{2})-(\d{2})T(\d{2}):(\d{2})/.exec(iso);
return m ? `${Number(m[1])}월 ${Number(m[2])}일 ${m[3]}:${m[4]} 관측` : undefined;
}
export function Weather() {
+2
View File
@@ -450,3 +450,5 @@
.w4-pine #location .loc .map{aspect-ratio:auto;height:100%;min-height:320px}
.w4-pine #location .loc .bd{align-self:center;padding:28px}
.w4-pine #festival .car--multi .slide{flex:0 0 260px}}
.w4-pine{--kc-r:14px;--kc-tw:600;--kc-mc:var(--pine);--kc-sub:var(--sub);--kc-soft:var(--alt)}
.w4-pine .cards2{row-gap:24px}
+16 -21
View File
@@ -2,6 +2,7 @@ import {useState} from 'react';
import type {LocalPlace} from '@o2o/shared';
import {useSite} from '@site/lib/site-context';
import {naverMapSearchUrl} from '@site/lib/format';
import {PhotoCard} from '../kit/Card';
import {Sheet} from '../paper/Sheet';
import {useWide} from './useWide';
@@ -66,18 +67,14 @@ export function Around() {
);
const card = (place: LocalPlace) => (
<button key={place.name} type="button" className="place" onClick={() => setOpen(place)}>
{place.imageUrl && (
<div className="ph">
<img src={place.imageUrl} alt={place.name} loading="lazy" />
</div>
)}
<div className="bd">
<h3>{place.name}</h3>
{place.distanceText && <small>{place.distanceText}</small>}
{place.description && <p className="clamp">{place.description}</p>}
</div>
</button>
<PhotoCard
key={place.name}
image={place.imageUrl}
title={place.name}
meta={place.distanceText}
desc={place.description}
onClick={() => setOpen(place)}
/>
);
return (
@@ -94,15 +91,13 @@ export function Around() {
</div>
<div className="guide guide--3">
{rail.slice(0, railMax).map((place) => (
<button key={place.name} type="button" className="place" onClick={() => setOpen(place)}>
<div className="ph">
<img src={place.imageUrl} alt={place.name} loading="lazy" />
</div>
<div className="bd">
<h3>{place.name}</h3>
{place.distanceText && <small>{place.distanceText}</small>}
</div>
</button>
<PhotoCard
key={place.name}
image={place.imageUrl}
title={place.name}
meta={place.distanceText}
onClick={() => setOpen(place)}
/>
))}
</div>
<a href="#/area" className="more">
+3 -13
View File
@@ -1,7 +1,7 @@
import {PlaceCategory} from '@o2o/shared';
import {HeroCatchphrase} from '@site/sections/HeroCatchphrase';
import {HeroCatchphrase, HeroRotator} from '@site/sections/HeroCatchphrase';
import {useSite} from '@site/lib/site-context';
import {bookingActionLabel, bookingLinks, heroFacts, isSectionEnabled, stayBookingView} from '@site/lib/derive';
import {bookingActionLabel, bookingLinks, isSectionEnabled, stayBookingView} from '@site/lib/derive';
import {Car} from '../paper/Car';
import {BOOK_EVENT} from '../paper/Rooms';
import {Weather} from './Weather';
@@ -20,7 +20,6 @@ export function Hero() {
const region = place.addressLocality ?? place.addressRegion;
const booking = bookingLinks(payload)[0];
const stay = lodging ? stayBookingView(payload) : null;
const chips = heroFacts(payload).map((row) => `${row.label} ${row.value}`);
return (
<>
@@ -56,16 +55,7 @@ export function Hero() {
) : (
fixed && <p className="hl in">{fixed}</p>
)}
{lodging && fixed && <p className="tagline">{fixed}</p>}
{chips.length > 0 && (
<div className="chips">
{chips.map((chip) => (
<span key={chip} className="chip">
{chip}
</span>
))}
</div>
)}
<HeroRotator className="tagline" />
<div className="hero-cta">
{stay ? (
<button type="button" className="btn" onClick={() => window.dispatchEvent(new Event(BOOK_EVENT))}>
+2 -13
View File
@@ -12,20 +12,9 @@ const MOOD_ICON = {
눈: SnowIcon,
} as const;
const OBSERVED = new Intl.DateTimeFormat('ko-KR', {
timeZone: 'Asia/Seoul',
month: 'long',
day: 'numeric',
hour: '2-digit',
minute: '2-digit',
hourCycle: 'h23',
});
function observed(iso: string): string | undefined {
const date = new Date(iso);
if (Number.isNaN(date.getTime())) return undefined;
const parts = Object.fromEntries(OBSERVED.formatToParts(date).map((p) => [p.type, p.value]));
return `${parts.month} ${parts.day}일 ${parts.hour}:${parts.minute} 관측`;
const m = /^\d{4}-(\d{2})-(\d{2})T(\d{2}):(\d{2})/.exec(iso);
return m ? `${Number(m[1])}월 ${Number(m[2])}일 ${m[3]}:${m[4]} 관측` : undefined;
}
export function Weather() {
@@ -337,3 +337,5 @@
.w4-round #about .amen li.on .ic{color:#15803d}
.w4-round #about .amen li.off .ic{color:#c2410c}
.w4-round #about .amen li.off{color:var(--sub)}
.w4-round{--kc-r:var(--r-card);--kc-tw:700;--kc-mc:var(--accent);--kc-sub:var(--sub);--kc-soft:var(--alt)}
.w4-round .cards2,.w4-round .guide--3{row-gap:24px}
+2 -1
View File
@@ -11,7 +11,8 @@ export function formatKoreanDate(iso: string | null | undefined): string {
if (!iso) return '';
const date = new Date(iso);
if (Number.isNaN(date.getTime())) return '';
return `${date.getFullYear()}년 ${date.getMonth() + 1}월 ${date.getDate()}일`;
const [year, month, day] = date.toLocaleDateString('sv-SE', {timeZone: 'Asia/Seoul'}).split('-').map(Number);
return `${year}년 ${month}월 ${day}일`;
}
/** 왜 한글 표기가 아닌가 답변 엔진은 본문에서 YYYY-MM-DD 를 찾아 최신성을 매긴다. */
+6 -2
View File
@@ -41,7 +41,7 @@ export function condition(code: number): string {
return WEATHER_CONDITION_BY_CODE[code] ?? '흐림';
}
/** 프리렌더 스냅샷으로 시작하고, 하이드레이션이 끝난 뒤에만 최신 캐시를 반영한다. */
/** 날씨는 열 때마다 바뀌는 값이라 HTML 에 굽지 않는다 — 하이드레이션 뒤에 스냅샷을 띄우고 최신 값으로 갈아 끼운다. */
export function useLiveWeather({
initial,
regionCode,
@@ -53,7 +53,11 @@ export function useLiveWeather({
latitude?: number;
longitude?: number;
}): LiveWeather | undefined {
const [weather, setWeather] = useState<LiveWeather | undefined>(initial);
const [weather, setWeather] = useState<LiveWeather | undefined>(undefined);
useEffect(() => {
setWeather((current) => current ?? initial);
}, [initial]);
useEffect(() => {
if (!regionCode || latitude == null || longitude == null) return;
+117 -27
View File
@@ -1,37 +1,127 @@
import {useEffect, useState, type CSSProperties} from 'react';
import {PlaceCategory} from '@o2o/shared';
import {useEffect, useLayoutEffect, useRef, useState, type CSSProperties} from 'react';
import {PlaceCategory, type Narrative} from '@o2o/shared';
import {useSite} from '@site/lib/site-context';
import lines from '@site/lib/lodging-catchphrases.json';
import './hero-catchphrase.css';
export function HeroCatchphrase({children}: {children?: string}) {
const {place, narrative} = useSite();
const lodging = place.category === PlaceCategory.LODGING;
const [index, setIndex] = useState(0);
const own = (narrative.catchphrases?.items ?? [])
.filter((item) => (item.kind ?? 'general') === 'general')
.map((item) => item.text.trim())
.filter(Boolean);
const phrases = own.length > 0 ? own : lines;
useEffect(() => {
if (!lodging) return;
const motion = window.matchMedia('(prefers-reduced-motion: reduce)');
const timer = window.setInterval(() => {
if (!document.hidden && !motion.matches) setIndex((value) => (value + 1) % phrases.length);
}, 6000);
return () => window.clearInterval(timer);
}, [lodging, phrases.length]);
type Item = NonNullable<Narrative['catchphrases']>['items'][number];
if (!lodging) return children;
const text = phrases[index % phrases.length];
const ROTATE_MS = 6000;
const SEASON_OF_MONTH = ['겨울', '겨울', '봄', '봄', '봄', '여름', '여름', '여름', '가을', '가을', '가을', '겨울'];
function stableIndex(key: string, size: number): number {
let hash = 0;
for (const ch of key) hash = (hash * 31 + ch.charCodeAt(0)) >>> 0;
return hash % size;
}
export function weatherBucket(condition?: string): string | undefined {
if (!condition) return undefined;
if (/눈/.test(condition)) return '눈';
if (/비|소나기/.test(condition)) return '비';
if (/흐림|구름/.test(condition)) return '흐림';
if (/맑/.test(condition)) return '맑음';
return undefined;
}
export function buildCycle(items: Item[], month: number, weather?: string, shuffle = true): string[] {
const text = (list: Item[]) => list.map((item) => item.text.trim()).filter(Boolean);
const general = text(items.filter((item) => (item.kind ?? 'general') === 'general'));
if (shuffle) {
for (let i = general.length - 1; i > 0; i -= 1) {
const j = Math.floor(Math.random() * (i + 1));
[general[i], general[j]] = [general[j], general[i]];
}
}
const pick = (list: string[]) => (list.length ? list[Math.floor(Math.random() * list.length)] : undefined);
const season = text(items.filter((item) => item.kind === 'season' && item.season === SEASON_OF_MONTH[month - 1]));
const monthly = text(items.filter((item) => item.kind === 'month' && Number(item.month) === month));
const weathered = weather ? text(items.filter((item) => item.kind === 'weather' && item.weather === weather)) : [];
const out: string[] = [];
let g = 0;
const nextGeneral = () => general[g++ % Math.max(general.length, 1)];
for (let round = 0; round < Math.max(1, Math.ceil(general.length / 3)); round += 1) {
out.push(nextGeneral(), shuffle ? pick(season) ?? '' : season[0] ?? '', nextGeneral(), shuffle ? pick(monthly) ?? '' : monthly[0] ?? '', nextGeneral());
if (weathered.length) out.push(shuffle ? pick(weathered) ?? '' : weathered[0]);
}
return out.filter(Boolean);
}
export function useMainCatchphrase(fallback?: string): string | undefined {
const {place, narrative, site} = useSite();
if (place.category !== PlaceCategory.LODGING) return undefined;
const own = (narrative.tagline ?? narrative.heroSubline ?? fallback)?.trim();
return own || lines[stableIndex(site.siteId || place.name, lines.length)];
}
export function HeroCatchphrase({children}: {children?: string}) {
const text = useMainCatchphrase(children);
if (!text) return children;
return (
<span className="hero-catchphrase">
{children && <span className="hero-catchphrase-fixed">{children}</span>}
<span className="w4d-line w4d-line--in" key={index}>
{text.split(/\s+/).map((word, i) => (
<span key={i}>{i > 0 && ' '}<span className="w4d-w"><span style={{'--w4d-d': `${i * 55}ms`} as CSSProperties}>{word}</span></span></span>
))}
</span>
{text.split(/\s+/).map((word, i) => (
<span key={i}>
{i > 0 && ' '}
<span className="w4d-w">
<span style={{'--w4d-d': `${i * 55}ms`} as CSSProperties}>{word}</span>
</span>
</span>
))}
</span>
);
}
export function HeroRotator({className}: {className?: string}) {
const {place, narrative, local} = useSite();
const box = narrative.catchphrases;
const items = box?.items ?? [];
const month = new Date().getMonth() + 1;
const [cycle, setCycle] = useState(() => buildCycle(items, month, weatherBucket(local.weather?.condition), false));
const [index, setIndex] = useState(0);
const [minHeight, setMinHeight] = useState<number>();
const ref = useRef<HTMLParagraphElement>(null);
useEffect(() => {
setCycle(buildCycle(box?.items ?? [], new Date().getMonth() + 1, weatherBucket(local.weather?.condition)));
}, [box, local.weather?.condition]);
useEffect(() => {
if (cycle.length < 2) return;
const motion = window.matchMedia('(prefers-reduced-motion: reduce)');
const timer = window.setInterval(() => {
if (!document.hidden && !motion.matches) setIndex((value) => (value + 1) % cycle.length);
}, ROTATE_MS);
return () => window.clearInterval(timer);
}, [cycle.length]);
useLayoutEffect(() => {
const node = ref.current;
if (!node) return;
const measure = () => {
const width = node.getBoundingClientRect().width;
if (!width) return;
const probe = node.cloneNode(false) as HTMLElement;
probe.style.cssText = `position:absolute;visibility:hidden;pointer-events:none;min-height:0;width:${width}px`;
node.parentNode?.appendChild(probe);
let max = 0;
for (const line of cycle) {
probe.textContent = line;
max = Math.max(max, probe.getBoundingClientRect().height);
}
probe.remove();
setMinHeight(Math.ceil(max));
};
measure();
window.addEventListener('resize', measure);
return () => window.removeEventListener('resize', measure);
}, [cycle]);
if (place.category !== PlaceCategory.LODGING || cycle.length === 0) return null;
return (
<p ref={ref} className={['hero-rotator', className].filter(Boolean).join(' ')} style={{minHeight}} aria-live="off">
<span className="hero-rotator-line" key={`${index}-${cycle[index % cycle.length]}`}>
{cycle[index % cycle.length]}
</span>
</p>
);
}
+18 -10
View File
@@ -1,8 +1,8 @@
/** 오늘의 날씨. */
import {Cloud, CloudRain, CloudSnow, Sun} from 'lucide-react';
import type {WeatherSky} from '@o2o/shared';
import type {WeatherSky, WeatherSnapshot} from '@o2o/shared';
import {useSite} from '@site/lib/site-context';
import {useLiveWeather} from '@site/lib/use-live-weather';
import {useLiveWeather, type LiveWeather} from '@site/lib/use-live-weather';
import {useWeatherNotes} from '@site/lib/use-weather-note';
import {weatherBand, weatherMood} from '@site/lib/derive';
import {Card, Section} from '@site/lib/ui';
@@ -16,6 +16,20 @@ function observedText(iso: string | undefined): string | undefined {
return `${Number(month)}월 ${Number(day)}일 ${hour}:${minute} 관측`;
}
/** 하늘 문구는 아홉 갈래(WeatherSky), 기온 문구는 기온대로 고른다. */
export function weatherLineSources(weather: LiveWeather | undefined, notes: WeatherSnapshot | undefined) {
const mood = weatherMood(weather?.condition ?? '');
const band = weatherBand(weather?.temperature ?? 0);
const condition = (weather?.condition ?? '') as WeatherSky;
const skyKey: WeatherSky = notes?.noteSets?.[condition] ? condition : mood;
return {
sky: notes?.noteSets?.[skyKey],
skyFallback: notes?.notes?.[mood] ?? weather?.note,
temp: notes?.tempNoteSets?.[band],
tempFallback: notes?.tempNotes?.[band],
};
}
export function WeatherSection() {
const payload = useSite();
const weather = useLiveWeather({
@@ -27,15 +41,9 @@ export function WeatherSection() {
const mood = weatherMood(weather?.condition ?? '');
const band = weatherBand(weather?.temperature ?? 0);
const notes = payload.local.weather;
// 하늘 문구는 아홉 갈래로 고른다(WeatherSky).
const condition = (weather?.condition ?? '') as WeatherSky;
const skyKey: WeatherSky = notes?.noteSets?.[condition] ? condition : mood;
const sources = weatherLineSources(weather, payload.local.weather);
/* 없으면 줄 자체를 그리지 않는다 — 기온대는 항상 계산되지만 문장은 사장님이 적은 것뿐이라, 빈 칸을 우리가 채우면 지어낸 관광 안내가 된다. */
const [line, bandLine] = useWeatherNotes(
notes?.noteSets?.[skyKey], notes?.notes?.[mood] ?? weather?.note,
notes?.tempNoteSets?.[band], notes?.tempNotes?.[band],
);
const [line, bandLine] = useWeatherNotes(sources.sky, sources.skyFallback, sources.temp, sources.tempFallback);
if (!weather) return null;
const observed = observedText(weather.observedAt);
const SkyIcon = MOOD_ICON[mood];
@@ -1,12 +1,16 @@
.hero-catchphrase { display: block; }
.hero-catchphrase-fixed { display: block; }
.hero-catchphrase .w4d-line { display: block; margin-top: 0.5rem; min-height: 1.5em; word-break: keep-all; }
.hero-catchphrase { display: block; word-break: keep-all; }
.hero-catchphrase .w4d-w { display: inline-block; overflow: hidden; vertical-align: bottom; }
.hero-catchphrase .w4d-w > span { display: inline-block; animation: lodging-word-in 0.45s both; animation-delay: var(--w4d-d); }
.hero-rotator { word-break: keep-all; }
.hero-rotator-line { display: block; animation: hero-rotator-in 0.6s both; }
@keyframes lodging-word-in {
from { opacity: 0; transform: translateY(100%); }
to { opacity: 1; transform: translateY(0); }
}
@keyframes hero-rotator-in {
from { opacity: 0; transform: translateY(6px); }
to { opacity: 1; transform: translateY(0); }
}
@media (prefers-reduced-motion: reduce) {
.hero-catchphrase .w4d-w > span { animation: none; }
.hero-catchphrase .w4d-w > span, .hero-rotator-line { animation: none; }
}
@@ -1,26 +1,65 @@
import {expect, it} from 'vitest';
import {renderToStaticMarkup} from 'react-dom/server';
import {PlaceCategory} from '@o2o/shared';
import {PlaceCategory, type SitePayload} from '@o2o/shared';
import {SiteProvider} from '@site/lib/site-context';
import {LayoutProvider} from '@site/lib/layout';
import {LAYOUTS} from '@site/layouts';
import {MOONLIGHT_STAY_PAYLOAD} from '@site/fixtures/moonlight-stay';
import lines from '@site/lib/lodging-catchphrases.json';
import {HeroCatchphrase} from './HeroCatchphrase';
import {buildCycle, HeroCatchphrase, HeroRotator, weatherBucket} from './HeroCatchphrase';
it('keeps the original lodging tagline in the static HTML', () => {
const html = renderToStaticMarkup(<SiteProvider payload={MOONLIGHT_STAY_PAYLOAD}><LayoutProvider value={LAYOUTS.basic}><HeroCatchphrase>고유문구</HeroCatchphrase></LayoutProvider></SiteProvider>);
expect(html).toContain('<span class="hero-catchphrase-fixed">고유문구</span>');
expect(html).toContain('w4d-line--in');
const text = html.replace(/<[^>]+>/g, '');
expect(text).toContain('고유문구' + lines[0]);
const text = (html: string) => html.replace(/<[^>]+>/g, '');
const render = (payload: SitePayload, node: React.ReactNode) =>
renderToStaticMarkup(<SiteProvider payload={payload}><LayoutProvider value={LAYOUTS.basic}>{node}</LayoutProvider></SiteProvider>);
it('shows the one fixed catchphrase and nothing that rotates in its place', () => {
const payload = structuredClone(MOONLIGHT_STAY_PAYLOAD);
payload.narrative.tagline = '담 너머 백 년 된 집';
expect(text(render(payload, <HeroCatchphrase />))).toBe('담 너머 백 년 된 집');
});
it('does not add lodging copy or controls to another category', () => {
it('falls back to one common line when the place has no catchphrase', () => {
const payload = structuredClone(MOONLIGHT_STAY_PAYLOAD);
delete payload.narrative.tagline;
delete payload.narrative.heroSubline;
expect(lines).toContain(text(render(payload, <HeroCatchphrase />)));
});
it('does not add lodging copy to another category', () => {
const payload = structuredClone(MOONLIGHT_STAY_PAYLOAD);
payload.place.category = PlaceCategory.CAFE;
const html = renderToStaticMarkup(<SiteProvider payload={payload}><LayoutProvider value={LAYOUTS.basic}><HeroCatchphrase>카페 소개</HeroCatchphrase></LayoutProvider></SiteProvider>);
expect(html).toBe('카페 소개');
expect(render(payload, <HeroCatchphrase>카페 소개</HeroCatchphrase>)).toBe('카페 소개');
});
it('leaves the rotating line out when there is nothing to rotate', () => {
const payload = structuredClone(MOONLIGHT_STAY_PAYLOAD);
delete payload.narrative.catchphrases;
expect(render(payload, <HeroRotator />)).toBe('');
});
it('rotates general, season, general, month, general, weather like the stay mockup', () => {
const cycle = buildCycle(
[
{text: '일반1', kind: 'general'},
{text: '일반2', kind: 'general'},
{text: '일반3', kind: 'general'},
{text: '가을 문구', kind: 'season', season: '가을'},
{text: '봄 문구', kind: 'season', season: '봄'},
{text: '9월 문구', kind: 'month', month: 9},
{text: '비 문구', kind: 'weather', weather: '비'},
],
9,
'비',
false,
);
expect(cycle).toEqual(['일반1', '가을 문구', '일반2', '9월 문구', '일반3', '비 문구']);
});
it('reads the sky into the four weather buckets', () => {
expect(weatherBucket('구름많음')).toBe('흐림');
expect(weatherBucket('비/눈')).toBe('눈');
expect(weatherBucket('소나기')).toBe('비');
expect(weatherBucket('맑음')).toBe('맑음');
});
it('ships ten distinct short phrases', () => {
+16 -12
View File
@@ -4,7 +4,7 @@ import {SiteProvider} from '@site/lib/site-context';
import {LayoutProvider} from '@site/lib/layout';
import {LAYOUTS} from '@site/layouts';
import {MOONLIGHT_STAY_PAYLOAD} from '@site/fixtures/moonlight-stay';
import {WeatherSection} from './WeatherSection';
import {WeatherSection, weatherLineSources} from './WeatherSection';
import type {WeatherSnapshot} from '@o2o/shared';
function render(weather?: WeatherSnapshot) {
@@ -13,29 +13,33 @@ function render(weather?: WeatherSnapshot) {
return renderToStaticMarkup(<SiteProvider payload={payload}><LayoutProvider value={LAYOUTS.basic}><WeatherSection /></LayoutProvider></SiteProvider>);
}
it('uses the first sky and temperature lines for deterministic HTML', () => {
it('keeps the weather out of the baked HTML — it is filled in the browser', () => {
const html = render({temperature: 30, observedAt: '2026-09-15T12:00', condition: '대체로 맑음', noteSets: {'대체로 맑음': ['맑음 첫 줄']}});
expect(html).toBe('');
});
it('picks sky lines by condition and temperature lines by band', () => {
const weather = {temperature: 30, observedAt: '2026-09-15T12:00', condition: '대체로 맑음', noteSets: {'대체로 맑음': ['맑음 첫 줄', '다음 줄']}, tempNoteSets: {'혹서': ['더위 첫 줄']}};
expect(render(weather)).toContain('맑음 첫 줄');
expect(render(weather)).toContain('더위 첫 줄');
expect(render(weather)).not.toContain('다음 줄');
expect(render(weather)).toBe(render(weather));
const sources = weatherLineSources(weather, weather);
expect(sources.sky).toEqual(['맑음 첫 줄', '다음 줄']);
expect(sources.temp).toEqual(['더위 첫 줄']);
});
it('uses condition-specific notes for fog, showers and thunderstorms', () => {
const weather = {temperature: 20, observedAt: '2026-09-15T12:00', condition: '보통 소나기', noteSets: {'보통 소나기': ['소나기 첫 줄']}, tempNoteSets: {'선선': ['선선 첫 줄']}};
expect(render(weather)).toContain('소나기 첫 줄');
expect(weatherLineSources(weather, weather).sky).toEqual(['소나기 첫 줄']);
});
it('uses condition-specific notes for the rain subtypes', () => {
const weather = {temperature: 5, observedAt: '2026-09-15T12:00', condition: '강한 착빙성 비', noteSets: {'강한 착빙성 비': ['어는비 첫 줄'], '보통 비': ['일반 비 첫 줄']}, tempNoteSets: {'추움': ['추움 첫 줄']}};
expect(render(weather)).toContain('어는비 첫 줄');
expect(render(weather)).not.toContain('일반 비 첫 줄');
expect(weatherLineSources(weather, weather).sky).toEqual(['어는비 첫 줄']);
});
it('preserves legacy single notes', () => {
const html = render({temperature: 15, observedAt: '2026-09-15T12:00', condition: '비', notes: {'비': '기존 비 안내'}, tempNotes: {'쌀쌀': '겉옷 안내'}});
expect(html).toContain('기존 비 안내');
expect(html).toContain('겉옷 안내');
const weather = {temperature: 15, observedAt: '2026-09-15T12:00', condition: '비', notes: {'비': '기존 비 안내'}, tempNotes: {'쌀쌀': '겉옷 안내'}};
const sources = weatherLineSources(weather, weather);
expect(sources.skyFallback).toBe('기존 비 안내');
expect(sources.tempFallback).toBe('겉옷 안내');
});
it('does not invent weather when an observation is missing', () => {