Compare commits

..
Author SHA1 Message Date
minaChoi 872d68e738 Merge remote-tracking branch 'origin/main' into fix/seo-no-store 2026-10-26 13:48:47 +09:00
minaChoi 90773081c2 fix: 지역 날씨 페이지(/today·/tomorrow)도 no-store — no-cache 면 모바일 크롬에서 다시 연 탭이 예전 HTML 로 지워진 빌드 파일을 불러 '날씨 불러오는 중'에서 멈춤 2026-10-26 13:47:34 +09:00
minaChoi e22564bc20 docs: 각 카드 그림 36장 기록 2026-10-26 13:47:32 +09:00
minaChoi fb2e6c4fac feat: 가을 각 카드 그림 28장 미리 생성(피크닉·캠핑·단풍·붕어빵·넷플릭스 등, gpt-6-sol) 2026-10-26 13:47:31 +09:00
minaChoi 512ae6b591 feat: 타로 각 카드 — 최근 7일에 쓴 각은 제외하고 상위 15개 안에서 먹거리·계절·집 각도 섞어 고르게(out/tarot-history.json) 2026-10-26 13:22:53 +09:00
minaChoi 01263f4149 docs: 타로 포스트 번호 2026-10-26 13:16:51 +09:00
minaChoi 387929683c docs: 10/26 몸 컨디션 타로 게시 기록 2026-10-26 13:16:19 +09:00
minaChoi a875dfabe6 fix: 슬래시 명령 argument-hint 따옴표(객체로 읽히던 것), 검수 통과 시 피드·인스타까지 바로 올리기 2026-10-26 11:46:12 +09:00
minaChoi 096d1effb0 docs: 10/26 세미정장 코디 게시 기록 2026-10-26 11:41:21 +09:00
minaChoi 928e9053cf feat: 최근 14일 안에 쓴 무신사 스냅은 다시 고르지 않음(out/snap-history.json) 2026-10-26 11:32:03 +09:00
minaChoi e1b5efc01b feat: /daily-ootd·/daily-tarot 슬래시 명령 분리 2026-10-26 11:12:41 +09:00
minaChoi a6251db762 feat: 그날 코디는 포스트 하나에 스타일 하나 — --style 로 스타일 태그(꾸안꾸·오피스룩…) 붙은 스냅만 고르고 제목 통일 2026-10-26 11:09:04 +09:00
minaChoi 814e64931d feat: 그날 코디 — 무신사 인기 스냅에서 사람별 코디 선정, Claude 옷 목록 추출, Codex 참고 사진 첨부 생성(npm run card -- ootd --daily), 카드 이름표 목록 2줄 허용 2026-10-26 10:40:21 +09:00
minaChoi 5cde680cb6 feat: /daily-cards 슬래시 명령 — 아침 타로·코디 카드 제작·검수·승인 대기 저장(게시는 안 함) 2026-10-26 09:42:43 +09:00
minaChoi 66125473eb feat: 코디 카드 옷 이름표를 그림 위 모서리 대신 그림 아래 목록 줄로(상의·겉옷·하의·신발·소품 순) 2026-10-25 16:22:25 +09:00
minaChoi 242129d036 docs: 꾸안꾸 코디 최종 게시(카드 11) 기록, 앱에서 지울 인스타 글 3건 2026-10-25 16:16:36 +09:00
minaChoi 2bffc721d4 fix: 코디 그림 프롬프트에 옷 자리(1 왼쪽 위·5 겉옷 위 가운데·2 오른쪽 위·3 왼쪽 아래·4 오른쪽 아래)를 적어 이름표와 맞추고, warm 꾸안꾸 40대 남자 겉옷을 얇은 가디건으로 2026-10-25 16:13:40 +09:00
minaChoi 82a401340a docs: 꾸안꾸 코디 최종 게시(카드 10) 기록, 앱에서 지울 인스타 글 2건 2026-10-25 16:06:26 +09:00
minaChoi aa9f22a166 feat: 코디 일교차 8도 이상이면 겉옷을 5번째 옷으로 그림·이름표에 포함(-outer 그림), 그림 프롬프트에 적힌 옷만 그리기 규칙, warm 꾸안꾸 겉옷 그림 4장 2026-10-25 15:08:51 +09:00
minaChoi 368a576bdb docs: 꾸안꾸 코디 재게시 기록, 40대~ 옷 데이터 TODO 2026-10-25 14:49:09 +09:00
minaChoi fde2f9f2a6 feat: warm 구간 꾸안꾸 40대~ 옷을 20-30대와 다르게(여 반팔 니트·슬랙스·로퍼·숄더백, 남 폴로·슬랙스·로퍼·시계), 그림 2장 2026-10-25 14:43:28 +09:00
minaChoi d9cf8d5874 docs: 10/25 운동 타로·꾸안꾸 코디 게시 기록, 카드 렌더 크롬 멈춤 TODO 2026-10-25 14:24:35 +09:00
minaChoi 885dd71cad feat: 코디 사람 구분을 20-30대·40대~ 여자·남자 4장으로 2026-10-25 14:20:40 +09:00
minaChoi bfa766d6d6 feat: 10/25 꾸안꾸 코디 그림(warm 구간 6장) 2026-10-25 10:43:24 +09:00
minaChoi 711fbbe7c6 feat: 10/25 각 카드 그림(러닝각·자전거각) 2026-10-25 10:35:39 +09:00
minaChoi 94ee8c2939 fix: 소개 카드 무대 스틸 왼쪽 발자국 아이콘 잘라 내고 칩 아이콘 크기 복구, 4·6·8번 모서리 캐릭터 제거 2026-10-24 21:55:04 +09:00
minaChoi c1d2d7c74a refactor: 캐릭터 이름을 구름·물방울로, 카드 스틸을 글자 없는 3D 장면으로, 앱 스크린샷 파일 삭제 2026-10-24 20:34:55 +09:00
minaChoi f2eed74e9d feat: 날씨각 캐릭터 보송·말랑(nalssigak-shorts Three.js)을 3D 릴스·소개 카드에, 카드에서 폰 프레임·스크린샷 제거(3D 스틸 무대·순위·기능 타일) 2026-10-24 20:26:03 +09:00
78 changed files with 1045 additions and 882 deletions

No files matched your search

+16
View File
@@ -0,0 +1,16 @@
---
description: 오늘 날씨 타로·코디 카드를 둘 다 만들어 검수하고 날씨각 피드와 인스타에 올린다 (/daily-tarot + /daily-ootd)
argument-hint: "<타로 주제> <코디 스타일> 예) 건강 운동 minimal"
---
오늘 인스타 카드를 만든다. 인자: `$ARGUMENTS` — 앞은 타로 주제(비어 있으면 Claude 가 오늘 날씨에 맞는 주제를 고른다), 마지막 단어가 casual·semi·formal·street·minimal 중 하나면 코디 스타일(없으면 minimal=꾸안꾸). 코디 포스트 하나는 스타일 하나: 네 사람 모두 같은 스타일.
재확인 질문 없이 순서대로 진행하고, 막히면 그 자리에서 보고하고 멈춘다. 타로는 `/daily-tarot` 의 순서대로, 코디는 `/daily-ootd` 의 순서대로 각각 만들고 검수한 뒤 올린다(두 명령 파일의 단계를 그대로 따른다).
1. 관리자 서버: `curl -s http://localhost:5175/api/targets` 에 `king` 이 있어야 한다. 없으면 `admin/` 에서 백그라운드로 켠다 (`admin/AGENTS.md` '켜기', 킹서버 키는 `ssh King_admin` 의 `~/proj/o2o-weather/.env` `ADMIN_API_KEY`, 값은 출력하지 않는다).
2. 예보: `curl -s "https://weather.o2o.kr/v1/weather/today?region=1114000000"` 의 `day` 가 오늘인지 보고 slots 의 기온·하늘·비 확률을 적어 둔다.
3. 타로: `cd admin && VITE_API_BASE_URL=https://weather.o2o.kr ADMIN_URL=http://localhost:5175 npm run card -- tarot --topic "<주제>" --color sky --post-wait`.
출력된 기획 문구를 2의 예보와 대조한다(숫자·하늘 묘사가 틀리면 `--copy <값> --feedback "실제 수치…"` 로 한 번만 다시). "일부 그림을 못 만들어" 가 나오면 멈추고 보고한다. 크롬이 한 장에서 45초 넘게 멈추면 그 프로세스를 죽이고 그 장만 다시 찍는다.
4. 코디(그날 코디): `npm run card -- ootd --daily --style <스타일> --color sky --post-wait`. 무신사 인기 스냅 중 그 스타일 태그(꾸안꾸·오피스룩·캐주얼·스트릿·정장)가 붙은 것에서 사람 4명(20-30대·40대~ 여·남) 코디를 고르고, Claude 가 옷 목록을 뽑고, Codex 가 참고 사진대로 플랫레이 그림을 그린다(사람당 2~4분). 고른 스냅 주소와 옷 목록이 출력된다. "스냅이 없어요"·"저장하지 못했어요" 가 나오면 멈추고 보고한다.
5. 검수(예외 없음): 만든 JPEG 전부를 **한 장씩 원본 크기로** Read 로 연다. 축소 시트로 판단하지 않는다. 볼 것: 글자 잘림·겹침, 그림 누락, 그림 속 사람·얼굴·글자, 코디는 그림 아래 옷 목록의 옷이 그림에 전부 있고 추가 옷이 없는지, 스냅 사진(`out/<날짜>/snaps/<사람>/snap.jpg`)과 옷·색이 같은지, 날씨 줄 수치가 예보와 맞는지. 틀리면 고치고 다시 찍어 다시 본다.
6. 새 타로 그림이 생겼으면 `git add admin/src/assets/gak-card admin/src/assets/tarot-bg` 후 `feat: <날짜> 각 카드 그림(…)` 로 커밋한다 (Claude 서명 없이). 코디 그림(`admin/public/daily`)은 커밋하지 않는다.
7. 보고(한국어, 짧게): 킹서버 카드 번호 2개(승인 대기), 만든 JPEG 경로, 참고한 스냅 주소 4개, 검수에서 고친 것, 남은 이슈. 올리는 건 사용자가 관리자 '만든 카드' 탭이나 "올려" 로 한다.
+15
View File
@@ -0,0 +1,15 @@
---
description: 오늘의 코디 카드 4장(20-30대·40대~ 여·남, 스타일 하나)을 무신사 인기 스냅으로 만들어 검수하고 날씨각 피드와 인스타에 올린다
argument-hint: "<스타일> minimal(꾸안꾸)·casual·semi(오피스)·formal·street (비우면 minimal)"
---
오늘의 코디 카드를 만들어 올린다. 인자: `$ARGUMENTS` — 코디 스타일 하나(minimal=꾸안꾸, casual=캐주얼, semi=세미정장·오피스, formal=정장, street=스트릿). 비어 있으면 minimal. 포스트 하나는 스타일 하나: 네 사람 모두 같은 스타일.
재확인 질문 없이 순서대로 진행하고, 막히면 그 자리에서 보고하고 멈춘다. 검수를 통과한 뒤에만 올린다(올린 건 되돌릴 수 없다).
1. 관리자 서버: `curl -s http://localhost:5175/api/targets` 에 `king` 이 있어야 한다. 없으면 `admin/` 에서 백그라운드로 켠다 (`admin/AGENTS.md` '켜기', 킹서버 키는 `ssh King_admin` 의 `~/proj/o2o-weather/.env` `ADMIN_API_KEY`, 값은 출력하지 않는다).
2. 만들기(승인 대기로 저장까지): `cd admin && VITE_API_BASE_URL=https://weather.o2o.kr ADMIN_URL=http://localhost:5175 npm run card -- ootd --daily --style <스타일> --color sky --post-wait`. 출력 끝의 `카드 N` 번호를 적어 둔다.
무신사 인기 스냅 중 그 스타일 태그가 붙은 것에서 사람 4명 코디를 고르고(최근 14일에 쓴 스냅 제외), Claude 가 옷 목록을 뽑고, Codex 가 스냅 사진·상품 썸네일을 참고해 플랫레이 그림을 그린다(사람당 2~4분, 총 10~15분). 고른 스냅 주소·옷 목록이 출력된다. "스냅이 없어요"·"저장하지 못했어요"·"Codex 실행이 실패" 가 나오면 멈추고 보고한다. 로그의 `rmcp … AuthRequired` 는 Codex 내부 경고라 무시한다. 크롬이 한 장에서 45초 넘게 멈추면 그 프로세스를 죽이고 그 장만 다시 찍는다.
3. 검수(예외 없음): 만든 JPEG 4장을 **한 장씩 원본 크기로** Read 로 연다. 축소 시트로 판단하지 않는다. 볼 것: 그림이 비어 있지 않은지, 그림 아래 옷 목록의 옷이 그림에 전부 있고 추가 옷이 없는지, 그림 속 사람·얼굴·글자, 스냅 사진(`admin/out/<날짜>/snaps/<사람>/snap.jpg`)과 옷·색이 같은지, 이름표 줄이 날씨 줄과 겹치지 않는지, 날씨 줄 수치가 예보(`https://weather.o2o.kr/v1/weather/today?region=1114000000`)와 맞는지. 틀리면 고치고 다시 만들어(2번, 새 카드 번호) 다시 본다. 못 고치면 올리지 말고 보고한다.
4. 올리기(검수 통과 시): `curl -s -X POST "http://localhost:5175/api/cards/<카드 N>/publish?target=king"` → `post_id` 확인, 이어서 `curl -s -X POST --max-time 600 "http://localhost:5175/api/cards/<카드 N>/instagram?target=king"` → `ig_media_id`. 인스타 링크: `~/projects/o2o-weather/.env` 의 `INSTAGRAM_ACCESS_TOKEN` 으로 `GET https://graph.instagram.com/v24.0/<ig_media_id>?fields=permalink` (토큰 값은 출력하지 않는다).
5. TODO.md 인스타 홍보 표에 한 줄(카드·포스트 번호, 인스타 링크, 참고 스냅 4개) 적고 `docs:` 커밋, `git push origin sns:main`. 코디 그림(`admin/public/daily`)은 커밋하지 않는다.
6. 보고(한국어, 짧게): 인스타 링크, 킹서버 카드·포스트 번호, 참고한 스냅 주소 4개, 검수에서 고친 것, 남은 이슈.
+16
View File
@@ -0,0 +1,16 @@
---
description: 오늘의 날씨 타로 카드 5장을 만들어 검수하고 날씨각 피드와 인스타에 올린다
argument-hint: "<타로 주제> 예) 건강 운동 · 연애 썸 · 경제 주식 (비우면 Claude가 고름)"
---
오늘의 날씨 타로 카드를 만들어 올린다. 인자: `$ARGUMENTS` — 타로 주제(대주제 소주제). 비어 있으면 Claude 가 오늘 날씨에 맞는 주제를 고른다.
재확인 질문 없이 순서대로 진행하고, 막히면 그 자리에서 보고하고 멈춘다. 검수를 통과한 뒤에만 올린다(올린 건 되돌릴 수 없다).
1. 관리자 서버: `curl -s http://localhost:5175/api/targets` 에 `king` 이 있어야 한다. 없으면 `admin/` 에서 백그라운드로 켠다 (`admin/AGENTS.md` '켜기', 킹서버 키는 `ssh King_admin` 의 `~/proj/o2o-weather/.env` `ADMIN_API_KEY`, 값은 출력하지 않는다).
2. 예보: `curl -s "https://weather.o2o.kr/v1/weather/today?region=1114000000"` 의 `day` 가 오늘인지 보고 slots 의 기온·하늘·비 확률을 적어 둔다.
3. 만들기(승인 대기로 저장까지): `cd admin && VITE_API_BASE_URL=https://weather.o2o.kr ADMIN_URL=http://localhost:5175 npm run card -- tarot --topic "<주제>" --color sky --post-wait` (주제가 없으면 `--topic` 없이). 출력 끝의 `카드 N` 번호를 적어 둔다.
출력된 기획 문구를 2의 예보와 대조한다(숫자·하늘 묘사가 틀리면 `--copy <값> --feedback "실제 수치…"` 로 한 번만 다시). 빠진 각 카드 그림은 Codex 가 자동으로 만든다(장당 1~5분). "일부 그림을 못 만들어" 가 나오면 멈추고 보고한다. 크롬이 한 장에서 45초 넘게 멈추면 그 프로세스를 죽이고 그 장만 다시 찍는다.
4. 검수(예외 없음): 만든 JPEG 5장을 **한 장씩 원본 크기로** Read 로 연다. 축소 시트로 판단하지 않는다. 볼 것: 글자 잘림·겹침, 카드 그림 누락, 그림 속 사람·글자, 리딩 문구의 수치·하늘 묘사가 예보와 맞는지, 말투(3문장, "~할 수 있어요" 남발·덕담 금지). 틀리면 고치고 다시 만들어(3번, 새 카드 번호) 다시 본다. 못 고치면 올리지 말고 보고한다.
5. 올리기(검수 통과 시): `curl -s -X POST "http://localhost:5175/api/cards/<카드 N>/publish?target=king"` → `post_id` 확인, 이어서 `curl -s -X POST --max-time 600 "http://localhost:5175/api/cards/<카드 N>/instagram?target=king"` → `ig_media_id`. 인스타 링크: `~/projects/o2o-weather/.env` 의 `INSTAGRAM_ACCESS_TOKEN` 으로 `GET https://graph.instagram.com/v24.0/<ig_media_id>?fields=permalink` (토큰 값은 출력하지 않는다).
6. 새 그림이 생겼으면 `git add admin/src/assets/gak-card admin/src/assets/tarot-bg` 후 `feat: <날짜> 각 카드 그림(…)` 로 커밋한다 (Claude 서명 없이). TODO.md 인스타 홍보 표에 한 줄(카드·포스트 번호, 인스타 링크) 적고 `docs:` 커밋, `git push origin sns:main`.
7. 보고(한국어, 짧게): 인스타 링크, 킹서버 카드·포스트 번호, 새 그림 수, 검수에서 고친 것, 남은 이슈.
+10 -2
View File
@@ -266,7 +266,15 @@
| [x] | 10/24 나들이 타로(등산각·드라이브각·한강각, 질문 "어느 곳으로 나들이를 가면 좋을까요?") 킹서버 카드 2 → 포스트 3648, 인스타 https://www.instagram.com/p/De3N7LnIJyZ/ 게시. 같은 날 오늘의 코디(캐주얼, mild 구간 그림 재사용) 킹서버 카드 3 → 포스트 3649, 인스타 https://www.instagram.com/p/De3OVz6oC9e/. 그림 생성 모델: `gpt-6-luna`는 그림을 파일로 저장 못 해 실패, `gpt-6-sol`·low로 바꿔 성공(장당 ~28k 토큰) | 사용자 요청 (10/24) | `admin/scripts/gen-image.mjs` |
| [x] | 10/24 날씨각 소개 카드(인스타 전용, 8장, `intro` 템플릿 — Codex gpt-6-sol이 설계) 인스타 https://www.instagram.com/p/De3SUTtoDGR/ 게시. 킹서버엔 카드 4로 저장만(승인 대기, 피드엔 안 나감). 해시태그는 `card_set.hashtags`로 인스타 캡션에만 붙음(타로·코디 템플릿도 적용) | 사용자 요청 (10/24) | `admin/src/cards/templates.tsx`, `backend/router/v1/card/card.py` |
| [ ] | 인스타 릴스(20초, 2.5D: Codex 3D 렌더풍 배경 + 카메라 패럴랙스, 무료 BGM, API로 업로드) — 백엔드에 mp4 공개 주소 + REELS 게시 추가 필요 | 사용자 요청 (10/24) | `backend/services/external/instagram.py` |
| [ ] | 인스타에 올라간 불량 게시물 삭제(앱에서만 가능): 소개 카드 De3SUTtoDGR·De3ycbAIPVw(스샷 잘림)·De31G7VIBEc(7·8번 장 치우침), 릴스 18152745022535272(폰 잘림) | 10/24 검수 실패 | — |
| [ ] | 소개 카드 최종본(`admin/out/2026-10-24/소개카드_1~8.jpg`, 19:41)과 3D 릴스(`admin/reels/intro3d/renders/intro3d.mp4`) — 사용자가 "올려"라고 할 때만 올림. 릴스 음악은 HeyGen 로그인(`~/.local/bin/heygen auth login --oauth`) 뒤 `npx hyperframes media-use resolve --type bgm` | 10/24 | `admin/reels/intro3d/` |
| [ ] | 인스타에 올라간 불량 게시물 삭제(앱에서만 가능): 소개 카드 De3SUTtoDGR·De3ycbAIPVw(스샷 잘림)·De31G7VIBEc(7·8번 장 치우침), 릴스 18152745022535272(폰 잘림), 10/25 꾸안꾸 코디 De58VfXINy0(20-30대와 40대~ 옷이 같음)·De5-8gboL-c(40대 여자 롱가디건·여름 옷)·De6B2gwIMXF(이름표 자리 어긋남) — 킹서버 포스트 3961·3962·3963은 deleted=true로 숨김 | 10/24·10/25 검수 실패 | — |
| [ ] | 소개 카드 최종본(`admin/out/2026-10-24/소개카드_1~8.jpg`, 10/24 21:54 — 8장 1:1 검수 완료, 모서리 캐릭터는 1번만·4·6·8번은 3D 스틸 안 캐릭터)과 3D 릴스(`admin/out/2026-10-24/릴스_3D.mp4`·표지 `릴스_3D_표지.jpg`, 21프레임 검수 완료) — 사용자가 "올려"라고 할 때만 올림. 릴스 음악은 HeyGen 로그인(`~/.local/bin/heygen auth login --oauth`) 뒤 `npx hyperframes media-use resolve --type bgm` | 10/24 | `admin/reels/intro3d/` |
| [x] | 코디 옷 데이터 — 세미정장·정장·스트릿·꾸안꾸 4스타일은 7개 기온 구간 전부 20-30대와 40대~ 옷이 같음(캐주얼만 다름, warm·꾸안꾸는 10/25 고침). 40대~ 여/남 옷 목록 54개를 새로 써서 검토받고 반영 — 10/26 그날 코디(--daily)로 대체해 고정 데이터는 예비용만 | 10/25 발견 | `admin/image-prompts/ootd.json` |
| [x] | 코디 카드 매일 다르게 — 고정 옷 데이터 대신 무신사 스냅 공개 API에서 오늘 구간 인기 코디를 사람별(40대~ 단정 태그 우선)로 골라 Claude가 옷 목록 추출, Codex가 참고 사진 첨부로 플랫레이 생성(`npm run card -- ootd --daily`, `/daily-cards`). 10/26 4장 검수 통과. 에이블리는 공개 API 없음(앱 전용)이라 미사용 | 사용자 요청 (10/26) | `admin/scripts/daily-ootd.mjs`, `snap.mjs`, `outfit.mjs`, `codex-image.mjs` |
| [x] | 10/26 세미정장 코디(그날 코디 첫 게시) — 킹서버 카드 12→포스트 4275, 인스타 https://www.instagram.com/p/De8O2kqATrl/. 무신사 스냅 4개 참고, 4장 1:1 검수 | 사용자 요청 (10/26) | `admin/scripts/daily-ootd.mjs` |
| [x] | 10/26 몸 컨디션 타로(건강: 등산각·자전거각·산책각) — 킹서버 카드 13→포스트 4276, 인스타 https://www.instagram.com/p/De8Zw7MIEVW/. 기획에서 3번 산책각 비 시점 틀린 것 피드백으로 고침. card.mjs --post-wait 가 ECONNRESET 으로 두 번 실패해 post-king.py 로 저장 | 사용자 요청 (10/26) | `admin/scripts/card.mjs` |
| [x] | 각 카드 그림 미리 생성 — 가을에 나올 만한 28장(피크닉·캠핑·놀이공원·빨래·단풍·억새·테니스·골프·군고구마·붕어빵·군밤·사진산책·별보기·환기·세차·이불빨래·데이트·치맥·막걸리·파전·우산·넷플릭스·집콕·한강밤바람·멍뭉산책·센치·감성노래·낚시) + 기존 8 = 36/68. 여름·한겨울 전용 32장은 철 되면 생성 | 사용자 요청 (10/26) | `admin/src/assets/gak-card/` |
| [ ] | 카드 자동화 다음 단계 — ① 생성 직후 자동 검사(Claude 비전: 옷 개수·사람·글자·추가 옷, 불합격 1회 재생성) ② 승인 대기 카드 메일/Teams 알림 + 서명 토큰 승인 링크(`GET /v1/card/{id}/approve`) ③ 맥 launchd 매일 06:30 `claude -p "/daily-cards"` ④ 그림 세트가 차면 킹서버로 이전 | 사용자 요청 (10/26) | `backend/router/v1/card/card.py`, `admin/scripts/` |
| [ ] | 앱 헤더가 400~448px 폭에서 컨테이너를 넘쳐 로그인 버튼이 잘림(`frontend/src/b/BLayout.tsx` TopBar). 캡처는 456px로 찍어 피했지만 실제 폰(430·440px)에서도 잘릴 수 있음 | 10/24 캡처 중 발견 | `frontend/src/b/BLayout.tsx` |
| [ ] | `npm run card`가 크롬 멈춤에 시간 제한이 없음 — 10/24 소개 카드 7번 장에서 헤드리스 크롬이 75분 멈춰 있었음(`--virtual-time-budget`만으론 안 끝남). `execFileSync`에 `timeout`(예: 60초) 주고 실패 시 그 장만 재시도 | 10/24 렌더 중 발견 | `admin/scripts/card.mjs` |
| [x] | 10/25 건강·운동 타로(킹서버 카드 7→포스트 3960, 인스타 https://www.instagram.com/p/De5iLg4AS_M/)·꾸안꾸 코디는 처음 올린 카드 8→포스트 3961(인스타 De58VfXINy0)이 40대~ 옷이 20-30대와 같아 숨기고, 40대~ 옷을 새로 써서 카드 9→포스트 3962(인스타 De5-8gboL-c)로 재게시했으나 40대 여자 그림에 롱가디건이 끼고 전체가 여름 옷으로 보여 다시 숨김. 일교차 8도 이상이면 겉옷을 5번째 옷으로 넣게 고쳐 카드 10→포스트 3963(인스타 De6B2gwIMXF)으로 올렸으나 그림 배치와 이름표 자리가 어긋나 숨김. 프롬프트에 옷 자리를 적고 다시 그려 카드 11→포스트 3964, 인스타 https://www.instagram.com/p/De6JRIkoKbT/ 로 최종 게시. 07:52 예약(세션 크론)이 세션 종료로 안 돌아 09:46 수동 실행. 코디는 사용자 결정으로 사람 구분을 20-30대·40대~ 4장으로 바꿈(f30·m30 그림 파일 8장은 남아 있으나 미사용). 새 그림 8장(러닝각·자전거각·warm 꾸안꾸 6) | 사용자 요청 (10/24) | `admin/image-prompts/ootd.json`, `admin/scripts/card.mjs` |
+3
View File
@@ -25,3 +25,6 @@ dist-ssr
# npm run card 결과
out
# 그날 코디 그림 (scripts/daily-ootd.mjs 가 만들고 카드가 /daily/... 로 읽는다)
public/daily
+19
View File
@@ -55,6 +55,25 @@ VITE_API_BASE_URL=http://localhost:9810 npm run card -- tarot --topic 주식 [--
- 관리자 서버가 비밀값을 `/api/post`·`/api/cards`에서만 붙인다. 브라우저엔 안 나간다. 킹서버 키는 킹서버 `.env`의 `ADMIN_API_KEY`와 같은 값.
- 켜는 예: `VITE_API_BASE_URL=http://localhost:9810 ADMIN_API_KEY=… KING_ADMIN_API_KEY=… npm run dev`
## 그날 코디 (무신사 인기 스냅 → 옷 추출 → 참고 사진대로 그림)
코디 카드는 고정 데이터(`image-prompts/ootd.json` 구간×스타일 옷) 대신 **그날 무신사 인기 스냅**으로 만든다. 같은 날씨라도 매일 다른 코디가 나온다.
```bash
VITE_API_BASE_URL=https://weather.o2o.kr npm run card -- ootd --daily --style minimal --color sky --post-wait
```
포스트 하나는 스타일 하나(`--style`, 기본 minimal=꾸안꾸): 네 사람 모두 그 스타일 태그(`scripts/snap.mjs STYLE_TAGS`)가 붙은 스냅에서 고르고 제목도 그 스타일로 통일한다.
흐름(`scripts/daily-ootd.mjs`):
1. 오늘 예보로 기온 구간을 정한다(`scripts/daily-ootd.mjs weatherToday`).
2. `scripts/snap.mjs`: 무신사 스냅 공개 API에서 구간에 맞는 태그(가을코디·간절기코디·겨울코디…)와 단정 키워드(오피스룩·댄디룩…)로 인기 스냅을 모으고, 상품 카테고리로 상의·하의·신발이 다 있는 것만 남긴 뒤 사람별(40대~ 먼저, 단정 태그 가산점)로 하나씩 고른다. 45일 지난 스냅, 구간에 안 맞는 아우터(패딩·코트 등)·반바지는 뺀다. 사진·상품 썸네일은 `out/<날짜>/snaps/<사람>/`에 참고용으로만 받고 어디에도 올리지 않는다.
3. `scripts/outfit.mjs`: Claude CLI(sonnet, Read 로 사진을 봄)가 자리별(top·outer·bottom·shoes·bag) 한글 이름표와 영어 그림 설명을 뽑는다.
4. `scripts/codex-image.mjs`: Codex 에 스냅 사진·상품 썸네일을 첨부(`-i`)해 같은 옷·색으로 우리 플랫레이 스타일 그림을 그린다 → `public/daily/<날짜>-<사람>.webp` (git 에 넣지 않음).
5. 카드는 `copy.outfits`(JSON 문자열)로 이름표·그림 주소를 받는다(`src/cards/ootd.ts dailyOutfits`). 제목은 Claude 가 정한 스타일 한 단어(꾸안꾸·오피스룩…).
에이블리는 공개 API가 없어 쓰지 않는다(앱 전용). 고정 데이터 방식(`--daily` 없이)은 그대로 남아 있다.
## 카드 그림 만들기 (Codex 이미지 생성)
**그림은 그날 만드는 카드에 필요한 것만 그때 만든다.** 조합(기온 구간 × 스타일 × 사람, 타로 78장)을 미리 일괄로 만들지 않는다. Codex 사용량이 한정돼 있다.
File diff suppressed because it is too large. Load diff
+141
View File
@@ -0,0 +1,141 @@
// 날씨각 캐릭터 (career/shorts/nalssigak-shorts 에서 가져옴): 구름 캐릭터 = 맑은 날파 초록 털뭉치(셸 텍스처 퍼), 물방울 캐릭터 = 비 오는 날파 반투명 파란 젤리
import * as THREE from 'three';
import { mergeGeometries } from 'three/addons/utils/BufferGeometryUtils.js';
const eyeWhite = new THREE.MeshStandardMaterial({ color: 0xffffff, roughness: 0.25 });
const pupilMat = new THREE.MeshStandardMaterial({ color: 0x1b2240, roughness: 0.15 });
function makeEyes(z, spread, size) {
const g = new THREE.Group();
const pupils = [];
for (const sx of [-1, 1]) {
const w = new THREE.Mesh(new THREE.SphereGeometry(size, 32, 24), eyeWhite);
w.scale.set(1, 1.15, 0.7);
w.position.set(sx * spread, 0, z);
const p = new THREE.Mesh(new THREE.SphereGeometry(size * 0.55, 24, 16), pupilMat);
p.position.set(sx * spread, 0, z + size * 0.62);
g.add(w, p);
pupils.push(p);
}
g.userData.pupils = pupils;
g.userData.base = pupils.map((p) => p.position.x);
return g;
}
// 털 노이즈는 고정 시드라 어느 프레임을 먼저 그려도 같다
let noiseTex = null;
function noise() {
if (noiseTex) return noiseTex;
const n = 128, data = new Uint8Array(n * n * 4);
let seed = 1234567;
const rnd = () => ((seed = (seed * 16807) % 2147483647) / 2147483647);
for (let i = 0; i < n * n; i++) { const v = Math.floor(rnd() * 255); data.set([v, v, v, 255], i * 4); }
noiseTex = new THREE.DataTexture(data, n, n, THREE.RGBAFormat);
noiseTex.wrapS = noiseTex.wrapT = THREE.RepeatWrapping;
noiseTex.magFilter = noiseTex.minFilter = THREE.NearestFilter;
noiseTex.needsUpdate = true;
return noiseTex;
}
const furVert = `
uniform float uLayer; varying vec2 vUv; varying vec3 vN; varying vec3 vView; varying float vL;
void main(){
vUv = uv; vL = uLayer;
vec3 p = position + normal * uLayer * 0.17;
p.y -= uLayer * uLayer * 0.04;
vN = normalize(normalMatrix * normal);
vec4 mv = modelViewMatrix * vec4(p, 1.0);
vView = -mv.xyz;
gl_Position = projectionMatrix * mv;
}`;
const furFrag = `
uniform sampler2D uNoise; uniform vec3 uRoot; uniform vec3 uTip; uniform vec3 uWarm;
uniform float uTint; uniform float uNight;
varying vec2 vUv; varying vec3 vN; varying vec3 vView; varying float vL;
void main(){
float n = texture2D(uNoise, vUv * vec2(70.0, 36.0)).r;
if (vL > 0.0 && n < vL * 0.98) discard;
vec3 N = normalize(vN);
float d = max(dot(N, normalize(vec3(0.4, 0.7, 0.6))), 0.0);
float rim = pow(1.0 - max(dot(N, normalize(vView)), 0.0), 2.2);
vec3 c = mix(uRoot, uTip, vL);
c = mix(c, uWarm * mix(0.7, 1.1, vL), uTint * 0.6);
vec3 col = c * (0.42 + 0.8 * d) * mix(0.45, 1.0, vL) + rim * 0.35 * mix(uTip, uWarm, uTint);
col *= mix(1.0, 0.62, uNight);
gl_FragColor = vec4(col, 1.0);
#include <colorspace_fragment>
}`;
let furGeo = null;
function fur() {
if (furGeo) return furGeo;
const parts = [new THREE.SphereGeometry(0.78, 64, 48)];
for (let k = 0; k < 8; k++) { const a = (k / 8) * Math.PI * 2 + Math.PI / 8; const g = new THREE.SphereGeometry(0.44, 48, 32); g.translate(Math.cos(a) * 0.8, Math.sin(a) * 0.8, 0); parts.push(g); }
for (let k = 0; k < 5; k++) { const a = (k / 5) * Math.PI * 2; const g = new THREE.SphereGeometry(0.36, 48, 32); g.translate(Math.cos(a) * 0.4, Math.sin(a) * 0.4, 0.48); parts.push(g); }
furGeo = mergeGeometries(parts);
return furGeo;
}
/** 구름 캐릭터. 돌려주는 값: { group, eyes, uniforms(uTint 0~1 노을, uNight 0~1 밤) } */
export function makeCloud(shells = 34) {
const uniforms = { uNoise: { value: noise() }, uRoot: { value: new THREE.Color(0x1f8a1a) }, uTip: { value: new THREE.Color(0x8ef06a) }, uWarm: { value: new THREE.Color(0xff9a4a) }, uTint: { value: 0 }, uNight: { value: 0 } };
const group = new THREE.Group();
const body = new THREE.Group();
for (let i = 0; i < shells; i++) {
const mat = new THREE.ShaderMaterial({ uniforms: { ...uniforms, uLayer: { value: i / (shells - 1) } }, vertexShader: furVert, fragmentShader: furFrag });
const m = new THREE.Mesh(fur(), mat);
m.renderOrder = i;
body.add(m);
}
group.add(body);
const eyes = makeEyes(1.05, 0.13, 0.1);
eyes.position.y = 0.06;
group.add(eyes);
return { group, eyes, uniforms };
}
/** 물방울 캐릭터. 돌려주는 값: { group, eyes, arms, front, back } — front.color 를 바꾸면 전체 색이 바뀐다 */
export function makeDrop(envMap) {
const group = new THREE.Group();
const body = new THREE.Group();
const front = new THREE.MeshPhysicalMaterial({ color: 0x7cbcff, transparent: true, opacity: 0.58, roughness: 0.06, metalness: 0, clearcoat: 1, clearcoatRoughness: 0.04, envMapIntensity: 1.6, iridescence: 0.25, depthWrite: false, envMap });
const back = front.clone();
back.side = THREE.BackSide;
back.opacity = 0.32;
const coreMat = new THREE.MeshPhysicalMaterial({ color: 0xbfe0ff, transparent: true, opacity: 0.45, roughness: 0.3, depthWrite: false, envMap });
const addJelly = (geo, parent) => { const b = new THREE.Mesh(geo, back); b.renderOrder = 1; const f = new THREE.Mesh(geo, front); f.renderOrder = 3; parent.add(b, f); };
const center = new THREE.SphereGeometry(0.72, 64, 48);
center.scale(1, 0.95, 0.72);
addJelly(center, body);
const core = new THREE.Mesh(new THREE.SphereGeometry(0.42, 40, 30), coreMat);
core.scale.set(1, 0.9, 0.6); core.position.set(0.12, -0.1, -0.1); core.renderOrder = 2;
body.add(core);
const arms = [];
for (let k = 0; k < 6; k++) {
const a = Math.PI / 2 + (k / 6) * Math.PI * 2 + (k % 2 ? 0.08 : -0.05);
const arm = new THREE.Group();
const stem = new THREE.CapsuleGeometry(0.2 + (k % 3) * 0.02, 0.62, 12, 24);
stem.rotateZ(-Math.PI / 2); stem.translate(0.78, 0, 0); stem.scale(1, 1, 0.8);
addJelly(stem, arm);
const tip = new THREE.SphereGeometry(0.27, 40, 30);
tip.scale(1, 1, 0.8); tip.translate(1.18, 0, 0);
addJelly(tip, arm);
arm.rotation.z = a; arm.userData.a = a;
arms.push(arm);
body.add(arm);
}
group.add(body);
const eyes = makeEyes(0.6, 0.15, 0.1);
eyes.position.set(0.05, -0.02, 0);
group.add(eyes);
return { group, eyes, arms, front, back };
}
export const JELLY = { blue: new THREE.Color(0x7cbcff), warm: new THREE.Color(0xffb27a), night: new THREE.Color(0x5b78c8) };
/** 숨쉬기·팔 흔들기: t 의 함수 */
export function animate(b, m, t, phase = 0) {
b.group.rotation.set(Math.sin(t * 1.3 + phase) * 0.06, Math.sin(t * 0.9 + phase) * 0.18, Math.sin(t * 1.7 + phase) * 0.03);
m.group.rotation.set(Math.sin(t * 1.3 + phase + 1.7) * 0.06, Math.sin(t * 0.9 + phase + 1.7) * 0.18, Math.sin(t * 1.7 + phase + 1.7) * 0.03);
m.arms.forEach((arm, i) => { arm.rotation.z = arm.userData.a + Math.sin(t * 2.6 + i * 1.1) * 0.07; arm.scale.setScalar(1 + Math.sin(t * 3.1 + i) * 0.04); });
}
Binary file not shown.

Before

Width:  |  Height:  |  Size: 41 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 31 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 81 KiB

+19
View File
@@ -0,0 +1,19 @@
<!doctype html><html><head><meta charset="utf-8">
<script type="importmap">{ "imports": { "three": "https://cdn.jsdelivr.net/npm/three@0.169.0/build/three.module.js", "three/addons/": "https://cdn.jsdelivr.net/npm/three@0.169.0/examples/jsm/" } }</script>
<style>html,body{margin:0;background:transparent}canvas{display:block}</style></head><body>
<canvas id="c" width="1200" height="600"></canvas>
<script type="module">
import * as THREE from 'three';
import { RoomEnvironment } from 'three/addons/environments/RoomEnvironment.js';
import { makeCloud, makeDrop } from './assets/characters.js';
const renderer = new THREE.WebGLRenderer({ canvas: document.getElementById('c'), alpha: true, antialias: true, premultipliedAlpha: true });
renderer.setPixelRatio(1); renderer.setSize(1200, 600, false); renderer.setClearColor(0x000000, 0);
const scene = new THREE.Scene();
const camera = new THREE.PerspectiveCamera(30, 2, 0.1, 100); camera.position.set(0, 0, 11);
const env = new THREE.PMREMGenerator(renderer).fromScene(new RoomEnvironment(), 0.04).texture;
scene.add(new THREE.HemisphereLight(0xffffff, 0x8aa0c8, 1.5)); const key = new THREE.DirectionalLight(0xffffff, 2.2); key.position.set(3, 5, 8); scene.add(key);
const b = makeCloud(), m = makeDrop(env);
b.group.position.set(-2.6, 0, 0); b.group.scale.setScalar(1.25); m.group.position.set(2.6, 0, 0); m.group.scale.setScalar(1.2);
scene.add(b.group, m.group);
renderer.render(scene, camera); document.title = 'ready';
</script></body></html>
+9 -14
View File
@@ -3,29 +3,24 @@
@font-face { font-family: 'Jua'; src: url('assets/fonts/Jua-Regular.ttf'); }
@font-face { font-family: 'Pretendard'; src: url('assets/fonts/PretendardVariable.woff2'); font-weight: 100 900; }
#root { position: absolute; inset: 0; overflow: hidden; }
#o5-title { position: absolute; left: 90px; top: 230px; width: 900px; margin: 0; font: 400 112px/1.18 'Jua', sans-serif; letter-spacing: -2px; color: #fff; text-shadow: 0 6px 22px rgba(20, 26, 50, 0.6); word-break: keep-all; }
#o5-title { position: absolute; left: 90px; top: 300px; width: 900px; margin: 0; font: 400 118px/1.18 'Jua', sans-serif; letter-spacing: -2px; color: #fff; text-shadow: 0 6px 22px rgba(10, 14, 40, 0.7); word-break: keep-all; }
#o5-title .w { display: inline-block; margin-right: 0.22em; }
#o5-note { position: absolute; left: 90px; top: 500px; margin: 0; font: 600 36px/1 'Pretendard', sans-serif; color: #dfe6ff; }
#o5-phone { position: absolute; left: 180px; top: 560px; width: 720px; height: 1500px; box-sizing: border-box; border: 12px solid #28304a; border-radius: 88px; background: #28304a; box-shadow: 0 30px 70px rgba(10, 14, 40, 0.5); overflow: hidden; }
#o5-phone img { display: block; width: 696px; height: auto; max-width: none; border-radius: 76px; }
#o5-chip { position: absolute; left: 560px; top: 480px; padding: 18px 36px; border-radius: 28px; background: #d4552a; color: #fff; font: 800 56px/1 'Pretendard', sans-serif; letter-spacing: -1px; box-shadow: 0 12px 34px rgba(212, 85, 42, 0.35); white-space: nowrap; transform-origin: 50% 50%; z-index: 2; }
#o5-chip { position: absolute; left: 0; right: 0; top: 1130px; margin: 0 auto; width: max-content; padding: 22px 44px; border-radius: 32px; background: #d4552a; color: #fff; font: 800 64px/1 'Pretendard', sans-serif; letter-spacing: -1px; box-shadow: 0 12px 34px rgba(212, 85, 42, 0.4); white-space: nowrap; transform-origin: 50% 50%; }
#o5-sub { position: absolute; left: 90px; top: 1250px; width: 900px; margin: 0; text-align: center; font: 700 48px/1.3 'Pretendard', sans-serif; letter-spacing: -1px; color: #dfe6ff; text-shadow: 0 4px 18px rgba(10, 14, 40, 0.7); word-break: keep-all; }
</style>
<div id="root" data-composition-id="o5" data-width="1080" data-height="1920">
<div id="o5-world" class="clip" data-start="0" data-duration="3" data-layout-allow-overlap>
<div id="o5-world" class="clip" data-start="0" data-duration="3">
<h1 id="o5-title"><span class="w">지금</span><span class="w">내</span><span class="w">동네</span><br /><span class="w">1위는?</span></h1>
<p id="o5-note">실제 화면 · 10.24 마포구</p>
<div id="o5-phone"><img src="assets/img/shot-home.webp" alt="날씨각 홈 화면" /></div>
<div id="o5-chip">68가지 각</div>
<p id="o5-sub">동네마다 점수가 달라요</p>
</div>
</div>
<script>
const tl = gsap.timeline({ paused: true });
tl.fromTo("#o5-phone", { y: 1400 }, { y: 0, duration: 0.7, ease: "power4.out" }, 0.05);
tl.fromTo("#o5-title .w", { opacity: 0, filter: "blur(8px)" }, { opacity: 1, filter: "blur(0px)", duration: 0.13, ease: "power4.out", stagger: 0.07 }, 0.4);
tl.fromTo("#o5-note", { opacity: 0 }, { opacity: 1, duration: 0.2 }, 0.6);
tl.fromTo("#o5-chip", { scale: 0.4, opacity: 0, rotate: -8 }, { scale: 1, opacity: 1, rotate: -6, duration: 0.45, ease: "back.out(1.6)" }, 1.2);
tl.to("#o5-phone", { y: 1500, duration: 0.3, ease: "power3.in" }, 2.7);
tl.to(["#o5-title", "#o5-chip", "#o5-note"], { opacity: 0, filter: "blur(8px)", duration: 0.2, ease: "power3.in" }, 2.75);
tl.fromTo("#o5-title .w", { opacity: 0, filter: "blur(8px)" }, { opacity: 1, filter: "blur(0px)", duration: 0.13, ease: "power4.out", stagger: 0.07 }, 0.3);
tl.fromTo("#o5-chip", { scale: 0.4, opacity: 0 }, { scale: 1, opacity: 1, duration: 0.45, ease: "back.out(1.6)" }, 1.3);
tl.fromTo("#o5-sub", { opacity: 0, filter: "blur(8px)" }, { opacity: 1, filter: "blur(0px)", duration: 0.2, ease: "power4.out" }, 1.6);
tl.to(["#o5-title", "#o5-chip", "#o5-sub"], { opacity: 0, filter: "blur(8px)", duration: 0.2, ease: "power3.in" }, 2.75);
window.__timelines["o5"] = tl;
</script>
</template>
-5
View File
@@ -9,8 +9,6 @@
#o6-claim b { color: #ffb48a; }
#o6-url { position: absolute; left: 90px; top: 1125px; width: 900px; margin: 0; text-align: center; font: 700 58px/1.2 'Pretendard', sans-serif; letter-spacing: -1px; color: #9ecbff; text-shadow: 0 4px 18px rgba(10, 14, 40, 0.6); }
#o6-toss { position: absolute; left: 90px; top: 1215px; width: 900px; margin: 0; text-align: center; font: 600 50px/1.2 'Pretendard', sans-serif; letter-spacing: -1px; color: #dfe6ff; text-shadow: 0 4px 18px rgba(10, 14, 40, 0.6); word-break: keep-all; }
#o6-rabbit { position: absolute; left: 90px; top: 1520px; width: 260px; }
#o6-bear { position: absolute; left: 730px; top: 1540px; width: 260px; }
</style>
<div id="root" data-composition-id="o6" data-width="1080" data-height="1920">
<div id="o6-world" class="clip" data-start="0" data-duration="3.5">
@@ -19,8 +17,6 @@
<p id="o6-claim">설치 없이 바로, <b>무료</b></p>
<p id="o6-url">weather.o2o.kr</p>
<p id="o6-toss">토스 앱에서 '날씨각' 검색해도 열려요</p>
<img id="o6-rabbit" src="assets/icons/rabbit.png" alt="" />
<img id="o6-bear" src="assets/icons/bear.png" alt="" />
</div>
</div>
<script>
@@ -30,7 +26,6 @@
tl.fromTo("#o6-claim", { opacity: 0, filter: "blur(8px)" }, { opacity: 1, filter: "blur(0px)", duration: 0.2, ease: "power4.out" }, 0.7);
tl.fromTo("#o6-url", { opacity: 0, filter: "blur(8px)" }, { opacity: 1, filter: "blur(0px)", duration: 0.2, ease: "power4.out" }, 1.0);
tl.fromTo("#o6-toss", { opacity: 0, filter: "blur(8px)" }, { opacity: 1, filter: "blur(0px)", duration: 0.2, ease: "power4.out" }, 1.3);
tl.fromTo(["#o6-rabbit", "#o6-bear"], { y: 240 }, { y: 0, duration: 0.6, ease: "expo.out", stagger: 0.08 }, 0.3);
tl.to({}, { duration: 0.2 }, 3.3);
window.__timelines["o6"] = tl;
</script>
+28 -1
View File
@@ -28,6 +28,8 @@
<script type="module">
import * as THREE from 'three';
import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js';
import { RoomEnvironment } from 'three/addons/environments/RoomEnvironment.js';
import { makeCloud, makeDrop, JELLY, animate as animateChars } from './assets/characters.js';
// 결정적 난수: 프레임을 어느 순서로 그려도 같은 별·구름 자리
function mulberry32(a) { return () => { a |= 0; a = (a + 0x6d2b79f5) | 0; let t = Math.imul(a ^ (a >>> 15), 1 | a); t = (t + Math.imul(t ^ (t >>> 7), 61 | t)) ^ t; return ((t ^ (t >>> 14)) >>> 0) / 4294967296; }; }
@@ -74,7 +76,7 @@
scene.add(new THREE.Points(starGeo, starMat));
// 상태: 타임라인이 이 값을 움직이고, 프레임마다 읽어서 그린다
const S = { elev: 9, azim: 168, turb: 3, ray: 2.4, mie: 0.004, g: 0.8, exp: 0.38, camX: 0, camY: 1.4, camZ: 12, lookY: 4.5, lookX: 0, cloud: 1, stars: 0, island: 0, pass: 0, rise: 0, spin: 0, mood: 0, glow: 0.6, iconWalk: 0, iconCamp: 0, iconSunset: 0, rain: 0 };
const S = { elev: 9, azim: 168, turb: 3, ray: 2.4, mie: 0.004, g: 0.8, exp: 0.38, camX: 0, camY: 1.4, camZ: 12, lookY: 4.5, lookX: 0, cloud: 1, stars: 0, island: 0, pass: 0, rise: 0, spin: 0, mood: 0, glow: 0.6, nightIcons: 0, chars: 1, charsEnd: 0, iconWalk: 0, iconCamp: 0, iconSunset: 0, rain: 0 };
const tex = new THREE.TextureLoader();
const sprite = (name, s) => {
@@ -88,7 +90,14 @@
// 하늘에 뜬 날씨각 3D 아이콘 (첫 장면), 비 (흐림 장면), 섬 옆 활동 아이콘 (증명 장면)
const skyIcons = [['sun', 3.0, 2.6, -9, 2.2], ['umbrella', -3.0, 1.2, -11, 1.8], ['bike', 2.6, -0.4, -5, 1.4], ['laundry', -1.4, -1.2, -15, 1.7]].map(([n, x, y, z, s], i) => { const o = sprite(n, s); o.position.set(x, y, z); o.userData = { x, y, z, phase: i * 1.3, amp: 0.18 + (i % 3) * 0.07 }; return o; });
const rainIcon = sprite('rain', 3.2); rainIcon.position.set(-2.4, 6.5, -12);
// 날씨각 캐릭터 구름 캐릭터(초록 털뭉치)·물방울 캐릭터(파란 젤리): 카메라 앞 한 벌, 섬 위 한 벌
const envTex = new THREE.PMREMGenerator(renderer).fromScene(new RoomEnvironment(), 0.04).texture;
const cloudA = makeCloud(), dropA = makeDrop(envTex);
const cloudB = makeCloud(22), dropB = makeDrop(envTex);
scene.add(cloudA.group, dropA.group);
const walkIcon = sprite('walk', 2.2), campIcon = sprite('camping', 2.2), sunsetIcon = sprite('sunset', 2.6);
// 밤하늘의 각 무리 (폰 화면 대신): 68가지 중 아홉
const NIGHT = [['hangang', -4.2, 2.0, 2.2], ['drive', 3.8, 3.2, 2.0], ['walk', -1.2, 5.2, 1.8], ['camping', 4.6, 7.4, 1.9], ['stars', -4.8, 8.6, 2.0], ['running', 1.4, 0.6, 1.6], ['laundry', -3.4, -1.6, 1.5], ['bike', 5.2, -0.4, 1.6], ['picnic', 0.6, 9.8, 1.7]].map(([n, x, y, sc], i) => { const o = sprite(n, sc * 1.45); o.userData = { x, y, phase: i * 0.9, sc: sc * 1.45 }; return o; });
// 구름: 날씨각 Fluent 3D 구름
const cloudTex = tex.load('assets/icons/cloud.png');
@@ -127,6 +136,9 @@
put('rock_largeA', 0.95, 1.05, 0.55, 1.1); put('rock_smallC', -0.75, 1.15, 0.8);
put('grass_large', 0.55, -0.05, 0.8); put('plant_bushLarge', -0.4, -0.05, 0.7, 1.5);
put('flower_redA', -1.15, 1.1); put('flower_yellowB', 0.55, 1.15, 1, 1); put('mushroom_redGroup', -0.05, -0.55, 0.8);
// 섬 위에 서 있는 구름·물방울 캐릭터 (섬과 함께 돈다)
cloudB.group.position.set(-0.85, 1.42, 1.25); cloudB.group.scale.setScalar(0.36); island.add(cloudB.group);
dropB.group.position.set(0.9, 1.5, 1.35); dropB.group.scale.setScalar(0.34); island.add(dropB.group);
island.position.set(0, -2.6, -118); island.scale.setScalar(2.0); island.rotation.x = 0.05;
scene.add(island);
})();
@@ -141,6 +153,7 @@
at(0, 2.4, { mood: 1, glow: 0.9 });
at(3, 0.8, { mood: 2, glow: 0.1 });
at(5.9, 0.9, { mood: 1, glow: 0.8 });
at(5.6, 0.5, { chars: 0 }, 'power2.in');
at(8.5, 5.5, { mood: 3, glow: 1.2 });
at(14.3, 1.2, { mood: 4, glow: 0 });
at(0, 3, { camZ: -20, camY: 2.2, lookY: 9, elev: 40, azim: 196, turb: 2.0, ray: 2.6, mie: 0.003, exp: 0.36 });
@@ -161,6 +174,9 @@
// 14.5~21 밤: 해가 지고 별이 켜지고 카메라가 위를 본다
at(14.3, 1.2, { elev: -9, exp: 0.26, stars: 1, camY: 5, lookY: 13, camX: 0, lookX: 0, iconWalk: 0, iconCamp: 0, iconSunset: 0 });
at(15.5, 5.5, { camY: 7, lookY: 16 }, 'none');
at(15.0, 0.9, { nightIcons: 1 }, 'back.out(1.4)');
at(17.7, 0.7, { charsEnd: 1 }, 'back.out(1.3)');
at(17.3, 0.3, { nightIcons: 0 }, 'power2.in');
tl.to({}, { duration: 0.1 }, 20.9);
const warm = new THREE.Color(0xffa060), noon = new THREE.Color(0xffffff), dusk = new THREE.Color(0xff6a6a);
@@ -193,6 +209,17 @@
walkIcon.position.set(ip.x - 4.2, ip.y + 5.2 + Math.sin(t * 1.2) * 0.12, ip.z + 2.2); walkIcon.material.opacity = S.iconWalk; walkIcon.scale.setScalar(2.2 * (0.4 + 0.6 * S.iconWalk));
campIcon.position.set(ip.x + 4.0, ip.y + 4.8 + Math.sin(t * 1.1 + 1) * 0.12, ip.z + 2.6); campIcon.material.opacity = S.iconCamp; campIcon.scale.setScalar(2.2 * (0.4 + 0.6 * S.iconCamp));
sunsetIcon.position.set(ip.x + 0.4, ip.y + 7.6 + Math.sin(t * 0.9 + 2) * 0.12, ip.z + 1.5); sunsetIcon.material.opacity = S.iconSunset; sunsetIcon.scale.setScalar(2.6 * (0.4 + 0.6 * S.iconSunset));
NIGHT.forEach((o, i) => { const k = C.clamp(S.nightIcons - i * 0.06, 0, 1); o.material.opacity = k; o.scale.setScalar(o.userData.sc * (0.3 + 0.7 * k)); o.position.set(S.camX + o.userData.x, S.lookY + o.userData.y - 2 + Math.sin(t * 1.1 + o.userData.phase) * 0.15, S.camZ - 30); });
// 카메라 앞 구름·물방울 캐릭터: 첫 장면엔 아래 양쪽, 섬 장면엔 화면 밖(아래), 밤엔 다시 올라온다
{ const up = Math.max(S.chars, S.nightIcons, S.charsEnd), drop = (1 - up) * 7;
cloudA.group.position.set(S.camX - 1.55, S.camY - 1.25 - drop + Math.sin(t * 1.3) * 0.08, S.camZ - 7.5); cloudA.group.scale.setScalar(0.66);
dropA.group.position.set(S.camX + 1.6, S.camY - 1.2 - drop + Math.sin(t * 1.3 + 1.7) * 0.08, S.camZ - 7.5); dropA.group.scale.setScalar(0.64);
cloudA.group.lookAt(camera.position); dropA.group.lookAt(camera.position);
animateChars(cloudA, dropA, t, 0); animateChars(cloudB, dropB, t, 2.1);
const warm = C.clamp(S.mood - 2, 0, 1) * (1 - C.clamp(S.mood - 3, 0, 1)), nightK = C.clamp(S.mood - 3, 0, 1);
for (const b of [cloudA, cloudB]) { b.uniforms.uTint.value = warm; b.uniforms.uNight.value = nightK; }
for (const m of [dropA, dropB]) { m.front.color.copy(JELLY.blue).lerp(JELLY.warm, warm * 0.75).lerp(JELLY.night, nightK * 0.5); m.back.color.copy(m.front.color); }
}
starMat.opacity = S.stars;
island.visible = S.island > 0.01;
island.rotation.y = -0.6 + S.spin * 0.9;
@@ -1 +0,0 @@
{"pid":54078,"host":"Minas-MacBook-Pro-2.local","boot":"29824523"}
+29 -5
View File
@@ -6,10 +6,10 @@
// --post 면 다 그린 뒤 날씨각 오늘 피드에 바로 올리고, --post-wait 면 승인 대기로 저장한다 (관리자 서버 /api/post).
// 지역은 고르지 않는다. 카드는 서울 예보로 만들고 카드에 지역 이름은 나가지 않는다 (src/cards/data.ts BASE_REGION)
import { execFileSync } from 'node:child_process'
import { existsSync, mkdirSync, readFileSync, rmSync } from 'node:fs'
import { existsSync, mkdirSync, readFileSync, rmSync, writeFileSync } from 'node:fs'
import { resolve } from 'node:path'
const SLIDES = { tarot: 5, ootd: 6, intro: 8 }
const SLIDES = { tarot: 5, ootd: 4, intro: 8 }
// 기본 문구가 서비스 데이터 그대로라 Claude 기획이 꼭 필요한 템플릿 (src/cards/templates.tsx autoPlan)
const AUTO_PLAN = ['tarot']
// src/cards/themes.ts THEMES 의 id
@@ -34,11 +34,14 @@ let copy = flag('--copy')
const topic = flag('--topic')
const feedback = flag('--feedback')
const color = flag('--color')
const styleArg = flag('--style')
const outArg = flag('--out')
const take = (name) => args.includes(name) && args.splice(args.indexOf(name), 1).length > 0
const noImages = take('--no-images')
let noImages = take('--no-images')
const postNow = take('--post')
const postWait = take('--post-wait')
// --daily: 코디를 고정 데이터 대신 그날 무신사 인기 스냅에서 뽑아 그린다 (scripts/daily-ootd.mjs)
const daily = take('--daily')
const [template] = args
if (!SLIDES[template]) fail(`사용: npm run card -- <${Object.keys(SLIDES).join('|')}> [--topic 주제] [--feedback 피드백] [--color ${THEMES.join('|')}] [--copy 값] [--out 폴더]`)
@@ -62,6 +65,16 @@ if (topic !== null || feedback !== null || (!copy && AUTO_PLAN.includes(template
console.log(`주제: ${body.topic}`)
for (const [k, v] of Object.entries(body.copy)) console.log(` ${k}: ${v.replaceAll('\n', ' / ')}`)
copy = Buffer.from(JSON.stringify({ ...current, ...body.copy })).toString('base64url')
// 타로: 오늘 고른 각을 적어 두면 다음 7일은 다른 각이 나온다 (scripts/plan.mjs recentCodes)
if (template === 'tarot') {
const file = resolve('out/tarot-history.json')
const today = new Date(Date.now() + 9 * 3600_000).toISOString().slice(0, 10)
const history = existsSync(file) ? JSON.parse(readFileSync(file, 'utf8')) : {}
const codes = ['c1', 'c2', 'c3'].map((k) => body.copy[k]).filter(Boolean)
history[today] = [...new Set([...(history[today] ?? []), ...codes])]
mkdirSync(resolve('out'), { recursive: true })
writeFileSync(file, JSON.stringify(history, null, 1))
}
}
{
@@ -72,6 +85,19 @@ if (topic !== null || feedback !== null || (!copy && AUTO_PLAN.includes(template
console.log(`다시 그리거나 피드백할 때: --copy ${copy}`)
}
const day = new Date(Date.now() + 9 * 3600_000).toISOString().slice(0, 10)
const outDir = resolve(outArg ?? `out/${day}`)
if (daily) {
if (template !== 'ootd') fail('--daily 는 ootd 템플릿에서만 써요.')
const { runDailyOotd, toCardOutfits } = await import('./daily-ootd.mjs')
// 포스트 하나는 스타일 하나: --style <casual|semi|formal|street|minimal>, 없으면 --copy 의 style, 그것도 없으면 꾸안꾸
const style = styleArg ?? decode(copy).style ?? 'minimal'
const { outfits } = await runDailyOotd({ outDir, style })
copy = Buffer.from(JSON.stringify({ ...decode(copy), style, outfits: JSON.stringify(toCardOutfits(outfits)) })).toString('base64url')
noImages = true
}
// 그날 카드에 필요한 그림 중 없는 것만 Codex로 만든다 (관리자 서버 /api/gen-image, 한 장씩)
if (!noImages) {
const start = await fetch(`${ADMIN_URL}/api/gen-image`, {
@@ -94,8 +120,6 @@ if (!noImages) {
}
}
const day = new Date(Date.now() + 9 * 3600_000).toISOString().slice(0, 10)
const outDir = resolve(outArg ?? `out/${day}`)
mkdirSync(outDir, { recursive: true })
const files = []
+44
View File
@@ -0,0 +1,44 @@
// Codex CLI의 이미지 생성 도구로 그림 한 장을 만들어 webp 로 저장한다. gen-image.mjs(고정 데이터 그림)와 daily-ootd.mjs(그날 코디 그림)가 같이 쓴다.
import { execFileSync } from 'node:child_process'
import { mkdtempSync, readdirSync, rmSync } from 'node:fs'
import { tmpdir } from 'node:os'
import { join } from 'node:path'
// 그림은 이미지 생성 도구가 만들고 Codex 는 도구를 부르고 결과를 저장하는 역할뿐이라 중간 모델·낮은 추론으로 고정한다 (가장 싼 gpt-6-luna 는 결과를 파일로 저장하지 못하고, 기본 설정의 gpt-6-astra·xhigh 는 한도를 금방 소진한다)
export const IMAGE_MODEL = process.env.CODEX_IMAGE_MODEL ?? 'gpt-6-sol'
/**
* @param {{ id: string, prompt: string, outPath: string, images?: string[], log?: (s: string) => void }} job
* images: 참고 사진(그 옷·색을 따라 그리게 할 때). 결과는 outPath(webp, 가로 1024).
* @returns {'ok' | 'not-saved'} 실패(한도·로그인)는 throw
*/
export function drawWithCodex({ id, prompt, outPath, images = [], log = console.log }) {
const work = mkdtempSync(join(tmpdir(), `gen-${id}-`))
const task = [
images.length
? '첨부한 참고 사진(코디 사진·상품 사진)의 옷·색·소재·실루엣을 그대로 따르되, 아래 프롬프트의 스타일로 새 그림을 내장 이미지 생성 도구로 만든다 (사진을 복사하지 말고, 사람은 절대 그리지 않는다).'
: '내장 이미지 생성 도구로 아래 프롬프트 그대로 이미지를 만든다 (비율은 프롬프트를 따른다).',
'만든 이미지를 직접 열어 확인한다: 사람 얼굴·손·마네킹·글자·숫자·로고가 있거나, 프롬프트의 물건이 빠지거나 잘렸으면 한 번만 다시 만든다 (사용량을 아끼려고 최대 2장).',
'통과한 한 장만 이 폴더에 result.png 로 저장한다. 다른 파일은 만들지 않는다.',
'',
prompt,
].join('\n')
log(`${id}: Codex로 그리는 중…${images.length ? ` (참고 사진 ${images.length}장)` : ''}`)
try {
// -i 는 파일을 여러 개 받아서 뒤의 프롬프트까지 파일로 읽는다 → 프롬프트는 stdin 으로 준다
const imageArgs = images.flatMap((p) => ['-i', p])
execFileSync('codex', ['exec', '--skip-git-repo-check', '-C', work, '-s', 'workspace-write', '-m', IMAGE_MODEL, '-c', 'model_reasoning_effort="low"', ...imageArgs], { input: task, stdio: ['pipe', 'ignore', 'inherit'] })
} catch (e) {
rmSync(work, { recursive: true, force: true })
throw new Error(`${id}: Codex 실행이 실패했어요 (${e.message}). 사용 한도나 로그인을 확인하세요.`)
}
const png = readdirSync(work).find((f) => f === 'result.png') ?? readdirSync(work).find((f) => f.endsWith('.png'))
if (!png) {
log(`${id}: Codex가 그림을 저장하지 않았어요. 작업 폴더: ${work}`)
return 'not-saved'
}
execFileSync('cwebp', ['-quiet', '-q', '88', '-resize', '1024', '0', join(work, png), '-o', outPath])
rmSync(work, { recursive: true, force: true })
log(`${id}: ${outPath}`)
return 'ok'
}
+101
View File
@@ -0,0 +1,101 @@
// 그날 코디: 오늘 예보 → 무신사 인기 스냅에서 사람별 코디 선정 → Claude 가 옷 목록 추출 → Codex 가 참고 사진대로 플랫레이 그림 → 카드용 copy.
// 사용: node scripts/daily-ootd.mjs [--out out/<날짜>] (npm run card -- ootd --daily 가 부른다)
import { mkdirSync, readFileSync, writeFileSync } from 'node:fs'
import { join, resolve } from 'node:path'
import { drawWithCodex } from './codex-image.mjs'
import { extractOutfit } from './outfit.mjs'
import { pickSnaps } from './snap.mjs'
const API_URL = process.env.VITE_API_BASE_URL ?? 'http://localhost:9810'
const REGION = '1114000000' // 서울 중구 (src/cards/data.ts BASE_REGION)
const spec = JSON.parse(readFileSync(resolve('image-prompts/ootd.json'), 'utf8'))
const PERSONA_ORDER = ['f20', 'm20', 'f40', 'm40']
const COUNT_WORD = { 3: 'three', 4: 'four', 5: 'five' }
/** 오늘 예보 → 아침·낮 기온, 기온 구간 (src/cards/data.ts temps 와 같은 계산) */
export async function weatherToday() {
const res = await fetch(`${API_URL}/v1/weather/today?region=${REGION}`)
const d = await res.json()
if (d.result?.success === false || !d.slots?.length) throw new Error(`오늘 예보를 받지 못했어요 (${d.result?.desc ?? '응답 없음'})`)
const hour = (s) => new Date(s.at).getHours()
const withTemp = d.slots.filter((s) => s.temp_c != null)
const day = withTemp.filter((s) => hour(s) >= 6 && hour(s) <= 21)
const t = day.length ? day : withTemp
const maxC = Math.round(Math.max(...t.map((s) => s.temp_c)))
const morningC = Math.round((t.find((s) => hour(s) === 6) ?? t[0]).temp_c)
const band = spec.bands.find((b) => maxC >= b.from) ?? spec.bands[spec.bands.length - 1]
return { day: d.day, morningC, maxC, band: band.id, layering: band.layering ?? '' }
}
// 카드 이름표 순서(상의·겉옷·하의·신발·가방)와 그림 번호 순서(1 상의·2 하의·3 신발·4 가방·5 겉옷)는 다르다
const LABEL_ORDER = ['top', 'outer', 'bottom', 'shoes', 'bag']
const DRAW_ORDER = ['top', 'bottom', 'shoes', 'bag', 'outer']
function layoutFor(slots) {
const has = (s) => slots.includes(s)
const topRow = has('outer') ? '(1) top-left, the outer layer in the top center, (2) top-right' : '(1) top-left, (2) top-right'
const bottomRow = has('bag') ? '(3) bottom-left and (4) bottom-right' : '(3) bottom-center'
return `top row: ${topRow}; bottom row: ${bottomRow}. Clearly separate spots, nothing else in between.`
}
function buildPrompt(persona, outfit, weather) {
const by = Object.fromEntries(outfit.items.map((it) => [it.slot, it]))
const drawn = DRAW_ORDER.filter((s) => by[s])
const items = drawn.map((s, i) => `(${i + 1}) ${by[s].prompt}${s === 'outer' ? ' as the outer layer' : ''}`).join(', ')
return spec.style
.replace('{items}', items)
.replace('{count}', COUNT_WORD[drawn.length] ?? String(drawn.length))
.replace('{layout}', layoutFor(drawn))
.replace('{persona}', spec.personas[persona].prompt)
.replace('{style}', outfit.style)
.replace('{trend}', 'follow the attached reference photos (the outfit photo and the product thumbnails): the same garments, colors, materials and silhouettes')
.replace('{layering}', weather.layering)
}
/** 포스트 하나는 스타일 하나(기본 꾸안꾸). 네 사람 모두 그 스타일 스냅에서 고르고 제목도 같은 스타일로 간다.
* @returns {Promise<{ weather: object, outfits: { persona: string, label: string, style: string, labels: string[], image: string, source: string, items: object[] }[] }>} */
export async function runDailyOotd({ outDir, style = 'minimal', log = console.log }) {
if (!spec.styles[style]) throw new Error(`스타일은 ${Object.keys(spec.styles).join(', ')} 중 하나예요: ${style}`)
const styleLabel = spec.styles[style].label
const weather = await weatherToday()
log(`오늘 ${weather.day}: 아침 ${weather.morningC}° · 낮 ${weather.maxC}° → 구간 ${weather.band} · 스타일 ${styleLabel}`)
mkdirSync(outDir, { recursive: true })
const picks = await pickSnaps({ band: weather.band, style, outDir: join(outDir, 'snaps'), log })
const dailyDir = resolve('public/daily')
mkdirSync(dailyDir, { recursive: true })
const outfits = []
for (const persona of PERSONA_ORDER) {
const pick = picks[persona]
log(`${persona}: Claude가 옷 목록을 뽑는 중… (${pick.url})`)
const outfit = await extractOutfit(pick, persona, weather)
// 제목은 Claude 가 본 분위기가 아니라 포스트 스타일로 통일한다
outfit.style = styleLabel
const by = Object.fromEntries(outfit.items.map((it) => [it.slot, it]))
const labels = LABEL_ORDER.filter((s) => by[s]).map((s) => by[s].label)
log(` ${outfit.style}: ${labels.join(' · ')}`)
const id = `${weather.day}-${persona}`
const outPath = join(dailyDir, `${id}.webp`)
const images = [pick.files.image, ...pick.files.thumbs.slice(0, 4).map((t) => t.path)]
const prompt = buildPrompt(persona, outfit, weather)
let result = drawWithCodex({ id, prompt, outPath, images, log })
if (result !== 'ok') result = drawWithCodex({ id, prompt, outPath, images, log })
if (result !== 'ok') throw new Error(`${id}: 그림을 두 번 다 저장하지 못했어요`)
outfits.push({ persona, label: spec.personas[persona].label, style: outfit.style, labels, image: `/daily/${id}.webp`, source: pick.url, items: outfit.items })
}
writeFileSync(join(outDir, 'outfits.json'), JSON.stringify({ weather, outfits }, null, 1))
return { weather, outfits }
}
/** 카드(copy.outfits)에 넣는 꼴: 사람·제목·스타일·이름표·그림 주소 */
export const toCardOutfits = (outfits) => outfits.map(({ persona, label, style, labels, image }) => ({ persona, label, style, labels, image }))
if (process.argv[1]?.endsWith('daily-ootd.mjs')) {
const args = process.argv.slice(2)
const flag = (n) => (args.includes(n) ? args[args.indexOf(n) + 1] : null)
const outArg = flag('--out')
const style = flag('--style') ?? 'minimal'
const day = new Date(Date.now() + 9 * 3600_000).toISOString().slice(0, 10)
const { outfits } = await runDailyOotd({ outDir: resolve(outArg ?? `out/${day}`), style })
const copy = Buffer.from(JSON.stringify({ outfits: JSON.stringify(toCardOutfits(outfits)), style, theme: 'sky' })).toString('base64url')
console.log(`카드 그리기: npm run card -- ootd --no-images --copy ${copy}`)
}
+28 -40
View File
@@ -1,12 +1,9 @@
// 카드 그림을 프롬프트 템플릿(image-prompts/<종류>.json)대로 Codex 이미지 생성으로 만들어 src/assets/<종류>/<id>.webp 에 넣는다.
// 넣은 그림은 카드에 자동으로 붙는다. 사용: npm run gen-image -- ootd <구간|스타일|구간-사람-스타일|missing> [스타일] [--force]
// 예: ootd cool casual (12~16도 캐주얼 6명) · ootd semi (세미정장 전 구간) · ootd cool-f20-casual · ootd missing formal
import { execFileSync } from 'node:child_process'
import { existsSync, mkdirSync, mkdtempSync, readFileSync, readdirSync, rmSync } from 'node:fs'
import { tmpdir } from 'node:os'
import { existsSync, mkdirSync, readFileSync } from 'node:fs'
import { join, resolve } from 'node:path'
const IMAGE_MODEL = process.env.CODEX_IMAGE_MODEL ?? 'gpt-6-sol'
import { drawWithCodex } from './codex-image.mjs'
function fail(message) {
console.error(message)
@@ -30,21 +27,31 @@ const outDir = resolve(`src/assets/${kind}`)
mkdirSync(outDir, { recursive: true })
const outPath = (id) => join(outDir, `${id}.webp`)
// 그림 한 장 = { id, 프롬프트 }. ootd 는 구간 × 스타일 × 사람, tarot 은 주제 꾸밈(skin)마다
// 그림 한 장 = { id, 프롬프트 }. ootd 는 구간 × 스타일 × 사람 × (옷 4개 | 겉옷까지 5개, id 끝에 -outer), tarot 은 주제 꾸밈(skin)마다
const jobs = spec.bands
? spec.bands.flatMap((b) =>
Object.entries(b.outfits).flatMap(([style, byPersona]) =>
Object.entries(byPersona).map(([persona, outfit]) => ({
id: `${b.id}-${persona}-${style}`,
band: b.id,
style,
prompt: spec.style
.replace('{items}', outfit.items)
.replace('{persona}', spec.personas[persona].prompt)
.replace('{style}', spec.styles[style].prompt)
.replace('{trend}', spec.styles[style].trends?.[persona] ?? '')
.replace('{layering}', b.layering ?? ''),
})),
Object.entries(byPersona).flatMap(([persona, outfit]) =>
[false, true].map((withOuter) => ({
id: `${b.id}-${persona}-${style}${withOuter ? '-outer' : ''}`,
band: b.id,
style,
prompt: spec.style
.replace('{items}', withOuter ? `${outfit.items}, (5) ${spec.outers?.[outfit.outer] ?? outfit.outer} as the outer layer` : outfit.items)
.replace('{count}', withOuter ? 'five' : 'four')
// 카드 이름표 자리(1 왼쪽 위·2 오른쪽 위·3 왼쪽 아래·4 오른쪽 아래·5 위 가운데)와 그림 위치를 맞춘다
.replace(
'{layout}',
withOuter
? 'top row from left to right: (1), then (5) the outer layer in the top center, then (2); bottom row: (3) bottom-left and (4) bottom-right. Five clearly separate spots, nothing else in the top center.'
: 'a 2x2 grid: (1) top-left, (2) top-right, (3) bottom-left, (4) bottom-right.',
)
.replace('{persona}', spec.personas[persona].prompt)
.replace('{style}', spec.styles[style].prompt)
.replace('{trend}', spec.styles[style].trends?.[persona] ?? '')
.replace('{layering}', b.layering ?? ''),
})),
),
),
)
: spec.items.map((it) => ({
@@ -67,33 +74,14 @@ for (const band of bands) {
console.log(`${band.id}: 이미 있어요 (다시 만들려면 --force)`)
continue
}
const prompt = band.prompt
const work = mkdtempSync(join(tmpdir(), `gen-${kind}-${band.id}-`))
const task = [
'내장 이미지 생성 도구로 아래 프롬프트 그대로 이미지를 만든다 (비율은 프롬프트를 따른다).',
'만든 이미지를 직접 열어 확인한다: 사람 얼굴·손·마네킹·글자·숫자·로고가 있거나, 프롬프트의 물건이 빠지거나 잘렸으면 한 번만 다시 만든다 (사용량을 아끼려고 최대 2장).',
`통과한 한 장만 이 폴더에 result.png 로 저장한다. 다른 파일은 만들지 않는다.`,
'',
prompt,
].join('\n')
console.log(`${band.id}: Codex로 그리는 중…`)
let result
try {
// 그림은 이미지 생성 도구가 만들고 Codex 는 도구를 부르고 결과를 저장하는 역할뿐이라 중간 모델·낮은 추론으로 고정한다 (가장 싼 gpt-6-luna 는 결과를 파일로 저장하지 못하고, 기본 설정의 gpt-6-astra·xhigh 는 한도를 금방 소진한다)
execFileSync('codex', ['exec', '--skip-git-repo-check', '-C', work, '-s', 'workspace-write', '-m', IMAGE_MODEL, '-c', 'model_reasoning_effort="low"', task], { stdio: ['ignore', 'ignore', 'inherit'] })
result = drawWithCodex({ id: band.id, prompt: band.prompt, outPath: outPath(band.id) })
} catch (e) {
rmSync(work, { recursive: true, force: true })
fail(`${band.id}: Codex 실행이 실패했어요 (${e.message}). 사용 한도나 로그인을 확인하세요.`)
fail(e.message)
}
const png = readdirSync(work).find((f) => f === 'result.png') ?? readdirSync(work).find((f) => f.endsWith('.png'))
// 저장을 빼먹는 건 그 한 장 문제라 나머지는 계속 만들고 끝에 모아서 알린다 (한도·로그인 실패는 위에서 바로 멈춤)
if (!png) {
console.error(`${band.id}: Codex가 그림을 저장하지 않았어요. 작업 폴더: ${work}`)
failed.push(band.id)
continue
}
execFileSync('cwebp', ['-quiet', '-q', '88', '-resize', '1024', '0', join(work, png), '-o', outPath(band.id)])
rmSync(work, { recursive: true, force: true })
console.log(`${band.id}: ${outPath(band.id)}`)
if (result !== 'ok') failed.push(band.id)
}
if (failed.length) fail(`못 만든 그림: ${failed.join(", ")} — 다시: npm run gen-image -- ${kind} ${failed.join(" ")}`)
+75
View File
@@ -0,0 +1,75 @@
// 고른 스냅(사진 + 입은 상품 목록)에서 카드에 쓸 옷 목록을 Claude CLI로 뽑는다: 자리별 한글 이름표와 그림용 영어 설명.
import { execFile } from 'node:child_process'
import { tmpdir } from 'node:os'
const SLOT_ORDER = ['top', 'outer', 'bottom', 'shoes', 'bag']
const PERSONA_TEXT = { f20: '20-30대 여자', m20: '20-30대 남자', f40: '40대 이상 여자', m40: '40대 이상 남자' }
const schema = {
type: 'object',
properties: {
style: { type: 'string', description: '이 코디를 한 단어로 (예: 꾸안꾸, 오피스룩, 캐주얼, 미니멀, 스트릿, 데일리)' },
items: {
type: 'array',
minItems: 4,
maxItems: 5,
items: {
type: 'object',
properties: {
slot: { type: 'string', enum: SLOT_ORDER },
label: { type: 'string', description: '카드 이름표. 한글 2~7자 (예: 스트라이프 티, 와이드 슬랙스, 로퍼)' },
prompt: { type: 'string', description: '그림용 영어 설명 한 구절: 색(대문자)·소재·실루엣 (예: a CHARCOAL wool single-breasted blazer)' },
},
required: ['slot', 'label', 'prompt'],
additionalProperties: false,
},
},
},
required: ['style', 'items'],
additionalProperties: false,
}
function buildPrompt(pick, persona, weather) {
const goods = pick.goods.map((g, i) => `${i + 1}. [${g.category1} > ${g.category2}] ${g.brand} ${g.name}`).join('\n')
const files = [pick.files.image, ...pick.files.thumbs.map((t) => t.path)]
return [
`무신사 스냅 코디 사진과 그 코디에 태그된 상품 목록이다. ${PERSONA_TEXT[persona]} 카드에 쓸 옷 목록을 만든다.`,
`오늘 서울 날씨: 아침 ${weather.morningC}도, 낮 최고 ${weather.maxC}도.`,
'',
'먼저 Read 도구로 이 파일들을 본다(첫 파일이 코디 사진, 나머지는 상품 썸네일):',
...files.map((f) => `- ${f}`),
'',
'태그된 상품:',
goods,
'',
'규칙:',
'- 자리(slot)는 top·bottom·shoes 는 반드시, 사진에서 겉옷(outer)을 입거나 걸쳤으면 outer 도, 가방이 있으면 bag 도 넣는다. 최대 5개, 자리마다 하나.',
'- 원피스면 top 으로 넣고 bottom 은 생략하지 말고 같은 원피스를 bottom 에 다시 넣지 않는다 → 원피스는 top, bottom 자리에는 사진의 다른 하의가 없으면 shoes·bag 으로 4개를 채운다.',
'- 상품 목록에 있는 옷은 그 상품명 기준으로, 없는 옷은 사진에서 보이는 대로. 색은 사진 기준.',
'- label 은 카드 이름표라 짧고 쉬운 한글(브랜드·영어 금지). prompt 는 영어 한 구절, 색은 대문자.',
'- style 은 코디 분위기 한 단어.',
'JSON 으로만 답한다.',
].join('\n')
}
/** @returns {Promise<{ style: string, items: { slot: string, label: string, prompt: string }[] }>} */
export function extractOutfit(pick, persona, weather) {
const args = ['-p', buildPrompt(pick, persona, weather), '--output-format', 'json', '--json-schema', JSON.stringify(schema), '--tools', 'Read', '--allowedTools', 'Read', '--no-session-persistence', '--model', 'sonnet']
return new Promise((done, fail) => {
execFile('claude', args, { cwd: tmpdir(), timeout: 240_000, maxBuffer: 10 * 1024 * 1024 }, (err, stdout) => {
if (err) return fail(new Error(`Claude CLI 실행 실패: ${err.message}. 터미널에서 claude 로그인 상태를 확인하세요.`))
let out
try {
out = JSON.parse(stdout)
} catch {
return fail(new Error(`Claude 답을 읽지 못했어요: ${stdout.slice(0, 300)}`))
}
const result = out.structured_output ?? (typeof out.result === 'string' ? JSON.parse(out.result) : null)
if (out.is_error || !result?.items?.length) return fail(new Error(`Claude가 옷 목록을 주지 못했어요: ${String(out.result ?? '').slice(0, 300)}`))
const seen = new Set()
const items = result.items.filter((it) => SLOT_ORDER.includes(it.slot) && !seen.has(it.slot) && seen.add(it.slot))
items.sort((a, b) => SLOT_ORDER.indexOf(a.slot) - SLOT_ORDER.indexOf(b.slot))
done({ style: String(result.style ?? '').trim() || '데일리', items })
})
})
}
+31 -8
View File
@@ -1,7 +1,7 @@
// 카드 문구 기획: 템플릿 칸·오늘 날씨·주제·피드백을 Claude CLI(claude -p)에 넘겨 칸별 문구를 받는다.
// 관리자 서버(/api/plan)와 npm run card --topic 이 같이 쓴다. API 키 없이 이 맥에 로그인된 Claude Code를 쓴다.
import { execFile } from 'node:child_process'
import { readdirSync, readFileSync } from 'node:fs'
import { existsSync, readdirSync, readFileSync } from 'node:fs'
import { tmpdir } from 'node:os'
import { resolve } from 'node:path'
@@ -20,6 +20,19 @@ const questionOf = (topic) => {
}
// 날씨 타로 카드 = 날씨각 각 카드 (서비스와 같은 각 목록)
const DECK = JSON.parse(readFileSync(resolve(import.meta.dirname, '../../backend/seed/index_definition.json'), 'utf8')).map((g) => ({ id: g.code, name: g.name, icon: g.icon, meaning: g.description }))
// 최근에 쓴 각은 빼서 매일 같은 카드가 나오지 않게 한다 (card.mjs 가 기획할 때마다 적는다)
const HISTORY_FILE = resolve(import.meta.dirname, '../out/tarot-history.json')
const HISTORY_DAYS = 7
function recentCodes() {
if (!existsSync(HISTORY_FILE)) return []
try {
const history = JSON.parse(readFileSync(HISTORY_FILE, 'utf8'))
const cutoff = Date.now() - HISTORY_DAYS * 86400_000
return [...new Set(Object.entries(history).filter(([day]) => new Date(day).getTime() >= cutoff).flatMap(([, codes]) => codes))]
} catch {
return []
}
}
const categoryOf = (topic) => TOPICS.find((c) => topic.includes(c.name) || c.subtopics.some((s) => topic.includes(s)))
const RULES = [
@@ -56,15 +69,25 @@ const TAROT_TONE = [
'키워드(k)는 4~8자 명사구("같이 걷는 시간", "먼저 보내는 한 줄"). 행운 포인트(l)는 시간·날씨·행동 한 줄 22자 이내("저녁 8시, 17도로 걷기 딱 좋아요").',
]
function tarotSection(topic) {
/** 오늘 고를 수 있는 각: 최근 7일에 쓴 각은 뺀다 (관리자가 고정한 카드는 남긴다) */
function availableDeck(fixed = {}) {
const recent = new Set(recentCodes())
const keep = new Set(fixed.cards ?? [])
return DECK.filter((c) => !recent.has(c.id) || keep.has(c.id))
}
function tarotSection(topic, fixed = {}) {
const deck = availableDeck(fixed)
const excluded = DECK.filter((c) => !deck.includes(c)).map((c) => c.name)
return [
'',
'## 각 카드 (이 목록에서만 고른다. card1·card2·card3에 서로 다른 code)',
questionOf(topic) ? `표지 질문(question)은 이것을 쓴다(피드백이 바꾸라고 하면 바꾼다): ${questionOf(topic)}` : '표지 질문(question)은 주제에 맞는 "오늘 ~할까요?" 꼴 질문 하나를 쓴다.',
'오늘 날씨 데이터의 오늘_각_점수에서 점수가 높은 각(오늘 실제로 하기 좋은 각) 가운데 질문과 엮을 수 있는 것을 고른다. 세 장은 서로 다른 답(하나는 긍정, 하나는 조건부, 하나는 기다리기 같은 식)이 되게 고르고, 되도록 아침·낮·저녁(밤) 각에서 하나씩 골라 세 장이 하루로 이어지게 한다.',
'오늘 날씨 데이터의 오늘_각_점수에서 점수가 높은 편(상위 15개 안)인 각 가운데 질문과 엮을 수 있는 것을 고른다. 매일 같은 야외 운동 각(산책·자전거·등산·드라이브)만 반복하지 말고 먹거리·계절·집·동네 각도 섞어 날마다 다른 카드가 나오게 한다. 세 장은 서로 다른 답(하나는 긍정, 하나는 조건부, 하나는 기다리기 같은 식)이 되게 고르고, 되도록 아침·낮·저녁(밤) 각에서 하나씩 골라 세 장이 하루로 이어지게 한다.',
excluded.length ? `최근 7일에 쓴 각이라 오늘은 고를 수 없음(목록에서 뺐다): ${excluded.join(', ')}` : '',
...TAROT_TONE,
'',
...DECK.map((c) => `- ${c.id}: ${c.name} — ${c.meaning}`),
...deck.map((c) => `- ${c.id}: ${c.name} — ${c.meaning}`),
]
}
@@ -86,23 +109,23 @@ function buildPrompt(ctx, { topic, feedback, fixed = {} }) {
topic ? `## 주제: ${topic}` : `## 주제: 없음 — 다음 대주제·소주제 중 오늘 날씨와 어울리는 것을 하나 골라 topic에 "대주제 소주제"로 적고 그 주제로 쓴다: ${TOPICS.map((c) => `${c.name}(${c.subtopics.join('·')})`).join(', ')}`,
feedback ? `## 피드백 (반드시 반영): ${feedback}` : '',
'',
...(isTarot(ctx) ? tarotSection(topic) : []),
...(isTarot(ctx) ? tarotSection(topic, fixed) : []),
fixed.question ? `## 질문은 관리자가 정했다(그대로 쓴다): ${fixed.question}` : '',
fixed.cards?.length ? `## 카드는 관리자가 골랐다(card1·card2·card3 순서 그대로): ${fixed.cards.join(', ')}` : '',
'모든 칸을 채운 JSON으로만 답한다. topic에는 쓴 주제를 짧게 적는다.',
].join('\n')
}
function schema(ctx) {
function schema(ctx, fixed = {}) {
const properties = { topic: { type: 'string' } }
for (const f of ctx.fields) if (!(isTarot(ctx) && DECK_KEY.test(f.key))) properties[f.key] = { type: 'string' }
if (isTarot(ctx)) for (const k of ['card1', 'card2', 'card3']) properties[k] = { type: 'string', enum: DECK.map((c) => c.id) }
if (isTarot(ctx)) for (const k of ['card1', 'card2', 'card3']) properties[k] = { type: 'string', enum: availableDeck(fixed).map((c) => c.id) }
return { type: 'object', properties, required: Object.keys(properties), additionalProperties: false }
}
/** @returns {Promise<{ topic: string, copy: Record<string, string> }>} */
export function runPlan(ctx, { topic = '', feedback = '', fixed = {} } = {}) {
const args = ['-p', buildPrompt(ctx, { topic, feedback, fixed }), '--output-format', 'json', '--json-schema', JSON.stringify(schema(ctx)), '--tools', '', '--no-session-persistence', '--model', 'sonnet']
const args = ['-p', buildPrompt(ctx, { topic, feedback, fixed }), '--output-format', 'json', '--json-schema', JSON.stringify(schema(ctx, fixed)), '--tools', '', '--no-session-persistence', '--model', 'sonnet']
return new Promise((done, fail) => {
execFile('claude', args, { cwd: tmpdir(), timeout: 180_000, maxBuffer: 10 * 1024 * 1024 }, (err, stdout) => {
if (err) return fail(new Error(`Claude CLI 실행 실패: ${err.message}. 터미널에서 claude 로그인 상태를 확인하세요.`))
+233
View File
@@ -0,0 +1,233 @@
// 무신사 스냅(공개 API)에서 오늘 날씨에 맞는 인기 코디를 사람별로 하나씩 고른다. 사진·상품 썸네일은 그림 참고용으로만 내려받고 어디에도 올리지 않는다.
// 사용(확인용): node scripts/snap.mjs --band mild --out out/2026-10-26/snaps
import { existsSync, mkdirSync, readFileSync, writeFileSync } from 'node:fs'
import { join, resolve } from 'node:path'
// 최근에 쓴 스냅은 다시 고르지 않는다 (스타일이 달라도 같은 코디가 또 나오지 않게)
const HISTORY_FILE = resolve('out/snap-history.json')
const HISTORY_DAYS = 14
function loadHistory() {
if (!existsSync(HISTORY_FILE)) return {}
try {
return JSON.parse(readFileSync(HISTORY_FILE, 'utf8'))
} catch {
return {}
}
}
function recentIds(history) {
const cutoff = Date.now() - HISTORY_DAYS * 86400_000
return new Set(Object.entries(history).filter(([day]) => new Date(day).getTime() >= cutoff).flatMap(([, ids]) => ids))
}
const LIST_URL = 'https://content.musinsa.com/api2/content/snap/v1/snaps'
const GOODS_URL = (no) => `https://goods-detail.musinsa.com/api2/goods/${no}`
const IMAGE_HOST = 'https://image.msscdn.net'
const HEADERS = { 'User-Agent': 'Mozilla/5.0', Accept: 'application/json' }
/** 카드 사람(페르소나) → 성별과 "40대~"면 단정한 코디를 고르는 기준 */
export const PERSONAS = {
f20: { gender: 'WOMEN', mature: false },
m20: { gender: 'MEN', mature: false },
f40: { gender: 'WOMEN', mature: true },
m40: { gender: 'MEN', mature: true },
}
// 기온 구간(image-prompts/ootd.json bands 의 id)별로 찾는 태그와 걸러 낼 아우터
const HEAVY = /패딩|푸퍼|다운|롱코트|울코트|무스탕|플리스|기모|헤비|퍼 /i
const MID = /코트|자켓|재킷|점퍼|블루종|집업/i
const SHORTS = /쇼츠|반바지|shorts|숏팬츠|버뮤다/i
const SHORT_SLEEVE = /반팔|하프 슬리브|half sleeve|슬리브리스|민소매|sleeveless/i
const BAND = {
hot: { tags: ['여름코디', '간절기코디'], rejectGoods: [HEAVY, MID], rejectTags: [/겨울|패딩|코트/] },
warm: { tags: ['간절기코디', '가을코디'], rejectGoods: [HEAVY, MID], rejectTags: [/겨울|패딩|코트/] },
mild: { tags: ['가을코디', '간절기코디'], rejectGoods: [HEAVY, SHORTS], rejectTags: [/겨울|패딩/] },
cool: { tags: ['가을코디', '가을아우터'], rejectGoods: [HEAVY, SHORTS, SHORT_SLEEVE], rejectTags: [/겨울/] },
chilly: { tags: ['가을코디', '겨울코디'], rejectGoods: [/롱패딩|헤비/, SHORTS, SHORT_SLEEVE], rejectTags: [] },
cold: { tags: ['겨울코디'], rejectGoods: [SHORTS, SHORT_SLEEVE], rejectTags: [/여름|반팔/] },
freezing: { tags: ['겨울코디', '롱패딩'], rejectGoods: [SHORTS, SHORT_SLEEVE], rejectTags: [/여름|반팔|가을/] },
}
// 철 지난 스냅은 뺀다
const MAX_AGE_DAYS = 45
// 포스트 하나는 스타일 하나: 네 사람 모두 이 태그가 붙은 스냅에서 고른다 (image-prompts/ootd.json styles 의 id)
export const STYLE_TAGS = {
casual: ['데일리룩', '캐주얼룩', '캐주얼'],
semi: ['오피스룩', '출근룩', '비즈니스캐주얼'],
formal: ['정장', '수트', '포멀룩'],
street: ['스트릿', '스트릿룩', '스트릿패션'],
minimal: ['꾸안꾸', '미니멀룩', '미니멀'],
}
// 40대~ 는 단정한 코디 태그로 한 번 더 모은다
const MATURE_KEYWORDS = { WOMEN: ['오피스룩', '출근룩', '미니멀룩'], MEN: ['오피스룩', '댄디룩', '비즈니스캐주얼'] }
const MATURE_TAG = /오피스|출근|미니멀|클래식|단정|하객|댄디|비즈니스|포멀|꾸안꾸/
const YOUNG_ONLY = /캠퍼스|학생|스트릿|스트리트|힙합|Y2K|고프코어|테크웨어/i
/** 상품 카테고리 → 카드 자리 */
export function slotOf(goods) {
const c = `${goods.category1 ?? ''} ${goods.category2 ?? ''}`
if (/원피스/.test(c)) return 'onepiece'
if (/아우터|가디건|자켓|재킷|코트|점퍼|패딩|블루종/.test(c)) return 'outer'
if (/상의|티셔츠|셔츠|니트|블라우스|후드/.test(c)) return 'top'
if (/바지|스커트|팬츠|슬랙스|데님|하의/.test(c)) return 'bottom'
if (/신발|스니커즈|구두|부츠|로퍼|샌들|슈즈/.test(c)) return 'shoes'
if (/가방|백팩|토트|숄더|크로스/.test(c)) return 'bag'
if (/모자|액세서리|주얼리|시계|양말|벨트|안경|스카프|머플러|캡/.test(c)) return 'acc'
return 'other'
}
async function getJson(url) {
const res = await fetch(url, { headers: HEADERS })
if (!res.ok) throw new Error(`${res.status} ${url}`)
return res.json()
}
/** 태그·키워드로 인기 스냅 목록 (한 번에 100개, 상품 번호·성별·태그·좋아요 포함) */
async function listSnaps(params, pages) {
const out = []
for (let page = 1; page <= pages; page++) {
const q = new URLSearchParams({ sort: 'POPULAR', size: '100', page: String(page), ...params })
const body = await getJson(`${LIST_URL}?${q}`)
const list = body.data?.list ?? []
for (const d of list) {
out.push({
id: d.id,
url: `https://www.musinsa.com/snap/${d.id}`,
gender: d.model?.gender ?? '',
age: d.model?.age ?? null,
likes: d.aggregations?.likeCount ?? 0,
tags: (d.tags ?? []).map((t) => t.name),
text: (d.detail?.content ?? '').slice(0, 200),
image: d.medias?.find((m) => m.type === 'IMAGE')?.path ?? d.thumbnailUrl ?? '',
createdAt: d.createdAt ?? '',
goodsNos: (d.goods ?? []).map((g) => g.goodsNo).filter(Boolean),
})
}
if (list.length < 100) break
}
return out
}
async function goodsDetail(no) {
const d = (await getJson(GOODS_URL(no))).data
const thumb = d.thumbnailImageUrl ?? ''
const g = {
no,
name: d.goodsNm ?? '',
brand: typeof d.brand === 'object' ? (d.brand?.name ?? '') : (d.brand ?? ''),
category1: d.category?.categoryDepth1Title ?? '',
category2: d.category?.categoryDepth2Title ?? '',
thumb: thumb ? (thumb.startsWith('http') ? thumb : IMAGE_HOST + thumb) : '',
}
return { ...g, slot: slotOf(g) }
}
async function withGoods(snap) {
const goods = []
for (const no of snap.goodsNos.slice(0, 8)) {
try {
goods.push(await goodsDetail(no))
} catch {
// 품절·삭제된 상품은 빼고 간다
}
}
return { ...snap, goods }
}
function fits(snap, band) {
const rule = BAND[band] ?? BAND.mild
if (snap.createdAt && Date.now() - new Date(snap.createdAt).getTime() > MAX_AGE_DAYS * 86400_000) return false
const blob = snap.goods.map((g) => `${g.name} ${g.category2}`).join(' | ')
if (rule.rejectGoods.some((re) => re.test(blob))) return false
if (rule.rejectTags.some((re) => snap.tags.some((t) => re.test(t)))) return false
const slots = new Set(snap.goods.map((g) => g.slot))
const hasTop = slots.has('top') || slots.has('onepiece')
const hasBottom = slots.has('bottom') || slots.has('onepiece')
return hasTop && hasBottom && slots.has('shoes') && !!snap.image
}
function score(snap, persona) {
let s = Math.log10(snap.likes + 10)
const tagBlob = snap.tags.join(' ')
const goods = snap.goods ?? []
if (PERSONAS[persona].mature) {
if (MATURE_TAG.test(tagBlob)) s += 1.5
if (YOUNG_ONLY.test(tagBlob)) s -= 2
if (goods.some((g) => /슬랙스|로퍼|니트|블라우스|코트|자켓|재킷|셔츠/.test(g.name + g.category2))) s += 0.5
if (goods.some((g) => /카고|후드|조거|스웨트/.test(g.name + g.category2))) s -= 1
} else if (MATURE_TAG.test(tagBlob) && !/꾸안꾸|데일리/.test(tagBlob)) s -= 0.3
return s
}
async function download(url, path) {
const res = await fetch(url, { headers: { 'User-Agent': 'Mozilla/5.0' } })
if (!res.ok) throw new Error(`${res.status} ${url}`)
writeFileSync(path, Buffer.from(await res.arrayBuffer()))
}
/** 사람별로 스냅 하나씩: { f20: {...snap, files: { image, thumbs[] }}, ... }. style 을 주면 네 사람 모두 그 스타일 태그가 붙은 스냅에서 고른다 */
export async function pickSnaps({ band, style, outDir, pages = 2, log = console.log }) {
mkdirSync(outDir, { recursive: true })
const rule = BAND[band] ?? BAND.mild
const styleTags = STYLE_TAGS[style] ?? []
const pool = new Map()
const add = (list) => list.forEach((s) => s.goodsNos.length >= 3 && !pool.has(s.id) && pool.set(s.id, s))
for (const tag of styleTags) add(await listSnaps({ tags: tag }, pages))
for (const tag of rule.tags) add(await listSnaps({ tags: tag }, pages))
for (const gender of ['WOMEN', 'MEN']) for (const kw of MATURE_KEYWORDS[gender]) add(await listSnaps({ keyword: kw }, 1))
const hasStyle = (s) => styleTags.length === 0 || s.tags.some((t) => styleTags.some((st) => t.includes(st)))
log(`무신사 스냅 후보 ${pool.size}개 (구간 ${band}${styleTags.length ? ` · 스타일 #${styleTags.join(' #')} ${[...pool.values()].filter(hasStyle).length}개` : ''}). 상품 정보를 받아 거르는 중…`)
const picks = {}
const history = loadHistory()
const used = recentIds(history)
// 40대~ 를 먼저 골라야 단정한 코디가 남는다. 좋아요 순으로 상품 정보를 받아 보며 맞는 첫 코디를 고른다
for (const persona of ['f40', 'm40', 'f20', 'm20']) {
const { gender } = PERSONAS[persona]
// 스타일 태그가 붙은 스냅을 먼저, 모자라면 나머지 (스타일 태그 없는 스냅은 뒤로)
const candidates = [...pool.values()]
.filter((s) => s.gender === gender && !used.has(s.id))
.sort((a, b) => Number(hasStyle(b)) - Number(hasStyle(a)) || score(b, persona) - score(a, persona))
.slice(0, 25)
let best = null
for (const c of candidates) {
const full = c.goods ? c : await withGoods(c)
pool.set(full.id, full)
if (fits(full, band)) {
best = full
break
}
}
if (!best) throw new Error(`${persona} 에 맞는 스냅이 없어요 (성별 ${gender}, 구간 ${band})`)
used.add(best.id)
const dir = join(outDir, persona)
mkdirSync(dir, { recursive: true })
const image = join(dir, 'snap.jpg')
await download(best.image, image)
const thumbs = []
for (const [i, g] of best.goods.entries()) {
if (!g.thumb || g.slot === 'other') continue
const p = join(dir, `goods-${i + 1}.jpg`)
try {
await download(g.thumb, p)
thumbs.push({ path: p, goods: g })
} catch {
// 썸네일 없으면 상품명만 쓴다
}
}
picks[persona] = { ...best, styled: hasStyle(best), files: { image, thumbs } }
log(` ${persona}: ${best.url} ♥${best.likes}${styleTags.length && !hasStyle(best) ? ' (스타일 태그 없음, 대체)' : ''} #${best.tags.slice(0, 3).join(' #')} | ${best.goods.map((g) => g.name).join(' / ').slice(0, 90)}`)
}
writeFileSync(join(outDir, 'picks.json'), JSON.stringify(picks, null, 1))
const today = new Date(Date.now() + 9 * 3600_000).toISOString().slice(0, 10)
history[today] = [...new Set([...(history[today] ?? []), ...Object.values(picks).map((p) => p.id)])]
mkdirSync(resolve('out'), { recursive: true })
writeFileSync(HISTORY_FILE, JSON.stringify(history, null, 1))
return picks
}
if (process.argv[1]?.endsWith('snap.mjs')) {
const args = process.argv.slice(2)
const flag = (n) => (args.includes(n) ? args[args.indexOf(n) + 1] : null)
const band = flag('--band') ?? 'mild'
const outDir = flag('--out') ?? `out/${new Date(Date.now() + 9 * 3600_000).toISOString().slice(0, 10)}/snaps`
await pickSnaps({ band, style: flag('--style') ?? undefined, outDir, pages: Number(flag('--pages') ?? 2) })
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 201 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 204 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 201 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 214 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 228 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 245 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 227 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 280 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 203 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 218 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 255 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 221 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 227 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 214 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 273 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 220 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 174 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 348 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 210 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 244 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 217 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 214 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 194 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 219 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 232 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 236 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 237 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 204 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 260 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 219 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 48 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 111 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 82 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 82 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 145 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 56 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 80 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 65 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 90 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 125 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 125 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 56 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 58 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 57 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 62 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 79 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 66 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 66 KiB

+53 -26
View File
@@ -133,7 +133,7 @@
top: 350px;
left: 80px;
width: 920px;
height: 840px;
height: 760px;
border-radius: 44px;
overflow: hidden;
background: var(--stage);
@@ -141,7 +141,7 @@
.ootd-stage > img {
width: 100%;
height: 100%;
object-fit: cover;
object-fit: contain;
}
.ootd-labels {
position: absolute;
@@ -156,6 +156,30 @@
.ootd-labels span:nth-child(even) {
justify-self: end;
}
/* 그림 아래 옷 목록: 그림 속 위치에 기대지 않고 따로 적는다 */
.ootd-items {
position: absolute;
top: 1126px;
left: 80px;
right: 80px;
margin: 0;
padding: 0;
list-style: none;
display: flex;
flex-wrap: wrap;
justify-content: center;
align-content: flex-start;
gap: 8px;
}
.ootd-items li {
padding: 7px 16px;
border-radius: 99px;
background: #fff;
font-size: 26px;
font-weight: 700;
box-shadow: 0 6px 16px #28304a1f;
white-space: nowrap;
}
.ootd-labels span {
padding: 8px 20px;
border-radius: 99px;
@@ -454,7 +478,7 @@
position: absolute;
left: 80px;
right: 80px;
bottom: 64px;
bottom: 40px;
display: flex;
align-items: center;
gap: 18px;
@@ -526,8 +550,8 @@
z-index: 2;
filter: drop-shadow(0 18px 14px #28304a22);
}
.intro-cover .rabbit { left: 250px; top: 810px; transform: rotate(-9deg); }
.intro-cover .bear { right: 235px; top: 830px; transform: rotate(8deg); }
.intro-cover .char-cloud { width: 440px; height: 440px; left: 90px; top: 700px; transform: rotate(-6deg); }
.intro-cover .char-drop { width: 420px; height: 420px; right: 90px; top: 730px; transform: rotate(6deg); }
.intro .intro-turn {
position: absolute;
bottom: 90px;
@@ -581,22 +605,28 @@
.intro-sky .intro-title { top: 205px; }
.intro-home .intro-sub,
.intro-sky .intro-sub { top: 450px; font-size: 42px; }
.intro-phone {
position: absolute;
overflow: hidden;
width: 390px;
height: 844px;
box-sizing: border-box;
padding: 0;
border: 8px solid var(--ink);
border-radius: 44px;
background: var(--ink);
box-shadow: 0 18px 0 var(--soft), 0 30px 58px #28304a28;
}
/* 스크린샷은 자르지 않고 베젤 안에 통째로 (가장자리 칩이 테두리·둥근 모서리에 먹히지 않게) */
.intro-phone img { display: block; width: 100%; height: auto; border-radius: 36px; }
.intro-phone.home,
.intro-phone.sky { top: 620px; left: 345px; }
/* 3D 릴스 스틸 무대: 둥근 모서리, 폰 틀 없음 */
.intro-stage { position: absolute; left: 90px; top: 600px; width: 900px; height: 620px; overflow: hidden; border-radius: 48px; box-shadow: 0 24px 60px #28304a2e; }
.intro-stage > img:first-child { display: block; width: 100%; height: 100%; object-fit: cover; }
/* 낮·노을 스틸은 왼쪽 위 발자국 아이콘이 걸리지 않게 왼쪽 190px를 잘라 낸다 */
.intro-stage.home > img:first-child { position: absolute; width: 1092px; max-width: none; height: auto; left: -194px; top: -271px; }
.intro-stage.sky > img:first-child { position: absolute; width: 1098px; max-width: none; height: auto; left: -198px; top: -273px; }
.intro-stage.cta { top: 640px; height: 560px; }
.intro-stage .intro-app { position: absolute; left: 50%; top: 50%; width: 260px; height: 260px; margin: -130px 0 0 -130px; border-radius: 60px; box-shadow: 0 24px 60px #0a0e2866; }
.intro-rank { position: absolute; left: 36px; right: 36px; bottom: 24px; margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 12px; }
.intro-rank li { display: flex; align-items: center; gap: 14px; padding: 8px 22px 8px 14px; border-radius: 22px; background: #ffffffee; color: var(--ink); font: 800 34px/1 'Pretendard Variable', Pretendard, sans-serif; letter-spacing: -1px; }
.intro-rank em { font-style: normal; font-size: 30px; color: var(--muted); min-width: 56px; }
.intro-rank img { width: 52px; height: 52px; }
.intro-rank b { margin-left: auto; font-size: 44px; color: var(--rust); }
.intro-chips { position: absolute; left: 36px; top: 36px; display: flex; flex-direction: column; gap: 12px; }
.intro-chips span { display: inline-flex; align-items: center; gap: 12px; width: max-content; padding: 14px 26px 14px 16px; border-radius: 24px; background: #ffffffee; color: var(--ink); font: 800 40px/1 'Pretendard Variable', Pretendard, sans-serif; letter-spacing: -1px; }
.intro-chips img { width: 56px; height: 56px; }
.intro-features { position: absolute; left: 90px; top: 600px; width: 900px; margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 22px; }
.intro-features li { display: grid; grid-template-columns: 150px 1fr; grid-template-rows: auto auto; column-gap: 24px; align-items: center; padding: 22px 30px; border-radius: 32px; background: #ffffffcc; box-shadow: 0 12px 32px #28304a1a; }
.intro-features img { grid-row: 1 / 3; width: 130px; height: 130px; object-fit: contain; }
.intro-features b { font: 800 50px/1.15 'Pretendard Variable', Pretendard, sans-serif; letter-spacing: -1px; color: var(--ink); }
.intro-features span { font: 600 36px/1.3 'Pretendard Variable', Pretendard, sans-serif; color: var(--muted); }
.intro-home .intro-note, .intro-sky .intro-note { left: 240px; right: 240px; top: 1262px; font-size: 32px; text-align: center; color: var(--muted); }
.intro-kinds .intro-title { top: 205px; font-size: 88px; }
.intro-gak-grid {
position: absolute;
@@ -624,7 +654,6 @@
.intro-more .intro-sub { top: 455px; font-size: 44px; }
.intro-more-icons { position: absolute; top: 750px; left: 90px; display: flex; flex-direction: column; gap: 34px; }
.intro-more-icons img { width: 105px; height: 105px; object-fit: contain; }
.intro-phone.week { top: 640px; left: 345px; }
.intro-more-icons { display: none; }
.intro .intro-note {
position: absolute;
@@ -634,10 +663,8 @@
letter-spacing: -1px;
word-break: keep-all;
}
.intro-more .intro-note { top: 1205px; width: 880px; z-index: 2; padding: 12px 18px; border-radius: 18px; background: var(--paper); }
.intro-more .intro-note { top: 1240px; font-size: 34px; color: var(--muted); }
.intro-cta .intro-title { top: 220px; font-size: 105px; }
.intro-cta .intro-sub { top: 470px; font-size: 48px; color: var(--rust); }
.intro-phone.gak { top: 650px; left: 400px; width: 280px; height: 560px; border-width: 6px; border-radius: 34px; }
.intro-cta .rabbit { width: 175px; height: 175px; left: 155px; top: 925px; transform: rotate(-8deg); }
.intro-cta .bear { width: 175px; height: 175px; right: 160px; top: 950px; transform: rotate(8deg); }
.intro-cta .intro-note { left: 240px; right: 240px; text-align: center; }
.intro-cta .intro-note { top: 1250px; font-size: 36px; text-align: center; }
+3 -5
View File
@@ -1,7 +1,7 @@
import type { CardData } from './data'
import { gakArt } from './gaks'
import { hasTarotBg } from './templates'
import { ootdBand, ootdOutfits } from './ootd'
import { needsOuter, ootdOutfits } from './ootd'
import type { Copy } from './templates'
export type ImageNeed = { kind: string; ids: string[] }
@@ -9,11 +9,9 @@ export type ImageNeed = { kind: string; ids: string[] }
/** 이 카드에 필요한 그림 중 아직 없는 것 (all 이면 전부). kind 는 image-prompts/<kind>.json, 그날 필요한 것만 Codex로 만든다. 타로는 그날 뽑힌 각 카드 그림 */
export function neededImages(templateId: string, d: CardData, copy: Copy, all = false): ImageNeed[] {
if (templateId === 'ootd') {
const style = copy.style || 'casual'
const band = ootdBand(d.maxC).id
const ids = ootdOutfits(d.maxC, style)
const ids = ootdOutfits(d.maxC, copy.style, undefined, needsOuter(d.maxC, d.morningC))
.filter((o) => all || !o.image)
.map((o) => `${band}-${o.persona}-${style}`)
.map((o) => o.imageId)
return ids.length ? [{ kind: 'ootd', ids }] : []
}
if (templateId === 'tarot') {
+30 -6
View File
@@ -1,8 +1,9 @@
import spec from '../../image-prompts/ootd.json'
/** 낮 최고기온 구간 × 스타일 × 사람별 옷. 옷 목록·카드 글자는 image-prompts/ootd.json 한 곳에서 정한다.
* 그림은 src/assets/ootd/<구간>-<사람>-<스타일>.webp 가 있으면 자동으로 붙는다 (npm run gen-image -- ootd <구간|스타일>) */
export type Outfit = { persona: string; label: string; labels: string[]; outer: string; image?: string }
* 그림은 src/assets/ootd/<구간>-<사람>-<스타일>.webp 가 있으면 자동으로 붙는다 (npm run gen-image -- ootd <구간|스타일>).
* 일교차가 크면(OUTER_GAP_C 이상) 겉옷을 5번째 옷으로 그린 <구간>-<사람>-<스타일>-outer.webp 를 쓰고 이름표에도 겉옷을 더한다 */
export type Outfit = { persona: string; label: string; style?: string; labels: string[]; outer: string; imageId: string; image?: string }
export type OotdBand = { id: string; from: number }
const IMAGES = import.meta.glob<string>('../assets/ootd/*.webp', { eager: true, import: 'default' })
@@ -18,17 +19,40 @@ export const styleLabel = (id?: string) => spec.styles[styleOf(id)].label
export const OOTD_BANDS: OotdBand[] = spec.bands.map((b) => ({ id: b.id, from: b.from }))
/** 아침·낮 기온 차가 이만큼이면 겉옷까지 보여 준다 (카드 날씨 줄의 '일교차 커요'와 같은 기준) */
export const OUTER_GAP_C = 8
export const needsOuter = (maxC: number, morningC: number) => maxC - morningC >= OUTER_GAP_C
export function ootdBand(maxC: number) {
return OOTD_BANDS.find((b) => maxC >= b.from) ?? OOTD_BANDS[OOTD_BANDS.length - 1]
}
/** 그 구간·스타일의 6명 옷 */
/** 그 구간·스타일의 6명 옷. bandId 를 주면 기온 대신 그 구간 (예시 카드용) */
export function ootdOutfits(maxC: number, style?: string, bandId?: string): Outfit[] {
/** 그날 무신사 스냅에서 뽑은 코디 (scripts/daily-ootd.mjs 가 copy.outfits 에 JSON 문자열로 넣는다). 없으면 undefined */
export function dailyOutfits(copy: Record<string, string>): Outfit[] | undefined {
if (!copy.outfits) return undefined
try {
const list = JSON.parse(copy.outfits) as { persona: string; label: string; style?: string; labels: string[]; image: string }[]
return list.map((o) => ({ persona: o.persona, label: o.label, style: o.style, labels: o.labels, outer: '', imageId: o.image, image: o.image }))
} catch {
return undefined
}
}
/** 그 구간·스타일의 사람별 옷. bandId 를 주면 기온 대신 그 구간 (예시 카드용). withOuter 면 겉옷 포함 그림·이름표 */
export function ootdOutfits(maxC: number, style?: string, bandId?: string, withOuter = false): Outfit[] {
const band = spec.bands.find((b) => b.id === (bandId || ootdBand(maxC).id))!
const st = styleOf(style)
return PERSONAS.map((p) => {
const o = band.outfits[st][p]
return { persona: p, label: spec.personas[p].label, labels: o.labels, outer: o.outer, image: IMAGES[`../assets/ootd/${band.id}-${p}-${st}.webp`] }
const imageId = `${band.id}-${p}-${st}${withOuter ? '-outer' : ''}`
return {
persona: p,
label: spec.personas[p].label,
// 그림 윗줄 순서(상의 · 겉옷 · 하의)와 같게 겉옷을 두 번째에
labels: withOuter ? [o.labels[0], o.outer, ...o.labels.slice(1)] : o.labels,
outer: o.outer,
imageId,
image: IMAGES[`../assets/ootd/${imageId}.webp`],
}
})
}
+60 -26
View File
@@ -1,13 +1,14 @@
import type { ReactNode } from 'react'
import tarotBack from '../assets/tarot-back.webp'
import shotHome from '../assets/intro/shot-home.webp'
import shotGak from '../assets/intro/shot-gak.webp'
import shotSky from '../assets/intro/shot-sky.webp'
import shotWeek from '../assets/intro/shot-week.webp'
import stillDay from '../assets/intro/still-day.webp'
import cloudChar from '../assets/intro/cloud-char.webp'
import dropChar from '../assets/intro/drop-char.webp'
import stillSunset from '../assets/intro/still-sunset.webp'
import stillNight from '../assets/intro/still-night.webp'
import type { CardData } from './data'
import { Frame, Lines } from './Frame'
import { tidy } from './text'
import { DEFAULT_STYLE, ootdBand, ootdOutfits, styleLabel } from './ootd'
import { DEFAULT_STYLE, dailyOutfits, needsOuter, ootdBand, ootdOutfits, styleLabel } from './ootd'
import { gakArt, gakByCode } from './gaks'
// 대주제(skin)마다 한 번 만든 배경 그림 (npm run gen-image -- tarot-bg <skin>). 없으면 민무늬 배경
@@ -45,11 +46,12 @@ export type Template = {
const ootd: Template = {
id: 'ootd',
name: '오늘의 코디',
about: '캐주얼·세미정장·정장·스트릿·꾸안꾸 중 하나 · 20대·30대·40대~ 여자·남자 6장 · 서울 낮 최고기온 구간별',
about: '캐주얼·세미정장·정장·스트릿·꾸안꾸 중 하나 · 20-30대·40대~ 여자·남자 4장 · 서울 낮 최고기온 구간별',
how: [
'서울(중구) 오늘 예보의 아침 6시~밤 9시 중 가장 높은 기온으로 7개 구간(28도 이상 · 23 · 17 · 12 · 9 · 5 · 그 아래) 중 하나를 고른다.',
'스타일(캐주얼·세미정장·정장·스트릿·꾸안꾸)을 고르면 바로 그 옷으로 바뀐다. Claude 기획은 쓰지 않는다.',
'구간 × 스타일 × 사람(20대·30대·40대~ 여자·남자)마다 옷 4가지가 image-prompts/ootd.json에 정해져 있고, 같은 파일의 문장으로 Codex가 그린 그림(src/assets/ootd/<구간>-<사람>-<스타일>.webp)을 붙인다. 그림이 없으면 옷 이름만 나간다.',
'구간 × 스타일 × 사람(20-30대·40대~ 여자·남자)마다 옷 4가지가 image-prompts/ootd.json에 정해져 있고, 같은 파일의 문장으로 Codex가 그린 그림(src/assets/ootd/<구간>-<사람>-<스타일>.webp)을 붙인다. 그림이 없으면 옷 이름만 나간다.',
'아침·낮 기온 차가 8도 이상이면 겉옷을 5번째 옷으로 그린 그림(<구간>-<사람>-<스타일>-outer.webp)을 쓰고 이름표에도 겉옷을 더한다.',
'카드에 지역 이름은 넣지 않는다.',
],
fields: [{ key: 'title', label: '제목 (사람·스타일 뒤에 붙음)' }],
@@ -63,27 +65,38 @@ const ootd: Template = {
hashtags: '#날씨각 #오늘의코디 #OOTD #데일리룩 #옷차림 #코디추천 #날씨 #오늘날씨 #서울날씨 #일상',
}),
warnings: (d, c) => {
const missing = ootdOutfits(d.maxC, c.style).filter((o) => !o.image)
if (dailyOutfits(c)) return []
const missing = ootdOutfits(d.maxC, c.style, undefined, needsOuter(d.maxC, d.morningC)).filter((o) => !o.image)
const id = `${ootdBand(d.maxC).id}`
return missing.length
? [`낮 최고 ${d.maxC}도 · ${styleLabel(c.style)}에 ${missing.map((o) => o.label).join(', ')} 옷 그림이 아직 없어요. 옷 이름만 나갑니다. (npm run gen-image -- ootd ${id} ${c.style ?? DEFAULT_STYLE})`]
: []
},
slides: (d, c) =>
ootdOutfits(d.maxC, c.style, c.band).map((o, i, all) => (
(dailyOutfits(c) ?? ootdOutfits(d.maxC, c.style, c.band, needsOuter(d.maxC, d.morningC))).map((o, i, all) => (
<Frame page={i} total={all.length} theme={c.theme} className="ootd" key={o.persona}>
<p className="meta">{d.dateLabel} · 오늘의 코디</p>
<h1 className="ootd-title">
<Lines text={`*${o.label}* ${styleLabel(c.style)}${c.title ? ` ${c.title}` : ''}`} />
<Lines text={`*${o.label}* ${o.style ?? styleLabel(c.style)}${c.title ? ` ${c.title}` : ''}`} />
</h1>
<div className="ootd-stage">
{o.image ? <img src={o.image} alt="" /> : null}
<div className={o.image ? 'ootd-labels' : 'ootd-labels only'}>
{o.labels.map((l) => (
<span key={l}>{l}</span>
))}
</div>
{o.image ? (
<img src={o.image} alt="" />
) : (
<div className="ootd-labels only">
{o.labels.map((l) => (
<span key={l}>{l}</span>
))}
</div>
)}
</div>
{o.image ? (
<ul className="ootd-items">
{o.labels.map((l) => (
<li key={l}>{l}</li>
))}
</ul>
) : null}
<p className="ootd-weather">
<img src={iconUrl(d.rainy ? 'rain' : d.maxC - d.morningC >= 8 ? 'sun_cloud' : 'sun')} alt="" />
<span>
@@ -270,7 +283,8 @@ const intro: Template = {
hashtags: '#날씨각 #날씨 #오늘날씨 #날씨앱 #앱인토스 #토스 #오늘뭐하지 #주말뭐하지 #노을 #노을맛집 #한강 #드라이브 #산책 #날씨타로 #오늘의코디 #서울날씨 #주말나들이 #가을 #일상',
}),
slides: (_d, c) => {
const phone = (src: string, name: string) => <div className={`intro-phone ${name}`}><img src={src} alt="" /></div>
// 3D 릴스 장면 스틸을 둥근 무대에 (폰 프레임·앱 스크린샷은 쓰지 않는다)
const stage = (src: string, name: string, children?: ReactNode) => <div className={`intro-stage ${name}`}><img src={src} alt="" />{children}</div>
const head = (text: string, name = '') => <h1 className={`intro-title ${name}`}><Lines text={tidy(text)} /></h1>
const sub = (text: string, name = '') => <p className={`intro-sub ${name}`}><Lines text={tidy(text)} /></p>
const frame = (page: number, className: string, children: ReactNode) => <Frame page={page} total={8} theme={c.theme || 'sky'} className={`intro intro-${className}`} key={page}>{children}</Frame>
@@ -278,8 +292,8 @@ const intro: Template = {
frame(0, 'cover', <>
{head(c.t1)}{sub(c.s1)}
<div className="intro-cover-stage" aria-hidden="true" />
<img className="intro-character rabbit" src={iconUrl('rabbit')} alt="" />
<img className="intro-character bear" src={iconUrl('bear')} alt="" />
<img className="intro-character char-cloud" src={cloudChar} alt="" />
<img className="intro-character char-drop" src={dropChar} alt="" />
<p className="intro-turn">넘겨 보세요 →</p>
</>),
frame(1, 'problem', <>
@@ -297,7 +311,17 @@ const intro: Template = {
</div>
{sub(c.s3)}
</>),
frame(3, 'home', <>{head(c.t4)}{sub(c.s4)}{phone(shotHome, 'home')}</>),
frame(3, 'home', <>
{head(c.t4)}{sub(c.s4)}
{stage(stillDay, 'home', (
<ol className="intro-rank">
{[['한강각', 84, 'hangang'], ['드라이브각', 82, 'drive'], ['산책각', 79, 'walk']].map(([n, v, ic], i) => (
<li key={n}><em>{i + 1}위</em><img src={iconUrl(String(ic))} alt="" /><span>{n}</span><b>{v}</b></li>
))}
</ol>
))}
<p className="intro-note">10.24 서울 중구 · 실제 점수</p>
</>),
frame(4, 'kinds', <>
{head(c.t5)}
<div className="intro-gak-grid">
@@ -308,18 +332,28 @@ const intro: Template = {
</div>
{sub(c.s5)}
</>),
frame(5, 'sky', <>{head(c.t6)}{sub(c.s6)}{phone(shotSky, 'sky')}</>),
frame(5, 'sky', <>
{head(c.t6)}{sub(c.s6)}
{stage(stillSunset, 'sky', (
<div className="intro-chips">
<span><img src={iconUrl('sunset')} alt="" />노을 피크 18:04</span>
<span>골든아워 17:08 ~ 17:44</span>
</div>
))}
<p className="intro-note">10.24 서울 마포구 기준</p>
</>),
frame(6, 'more', <>
{head(c.t7)}{sub(c.s7)}
<div className="intro-more-icons" aria-hidden="true"><img src={iconUrl('maple')} alt="" /><img src={iconUrl('camping')} alt="" /><img src={iconUrl('walk')} alt="" /></div>
{phone(shotWeek, 'week')}
<ul className="intro-features">
<li><img src={iconUrl('party')} alt="" /><b>주말 행사</b><span>이번 주말 가까운 축제</span></li>
<li><img src={iconUrl('maple')} alt="" /><b>단풍·계절</b><span>절정 시기와 계절 상식</span></li>
<li><img src={iconUrl('letter')} alt="" /><b>동네 이야기</b><span>우리 동네 날씨 한마디</span></li>
</ul>
<p className="intro-note"><Lines text={tidy(c.n7)} /></p>
</>),
frame(7, 'cta', <>
{head(c.t8)}{sub(c.s8)}
{phone(shotGak, 'gak')}
<img className="intro-character rabbit" src={iconUrl('rabbit')} alt="" />
<img className="intro-character bear" src={iconUrl('bear')} alt="" />
{stage(stillNight, 'cta', <img className="intro-app" src="/apple-touch-icon.png" alt="" />)}
<p className="intro-note"><Lines text={tidy(c.n8)} /></p>
</>),
]
+20 -1
View File
@@ -1,5 +1,7 @@
import { spawn } from 'node:child_process'
import { createReadStream, existsSync } from 'node:fs'
import type { IncomingMessage, ServerResponse } from 'node:http'
import { basename, resolve } from 'node:path'
import tailwindcss from '@tailwindcss/vite'
import react from '@vitejs/plugin-react'
import { defineConfig, type Plugin } from 'vite'
@@ -171,9 +173,26 @@ function postApi(): Plugin {
}
}
/** GET /daily/<날짜>-<사람>.webp → public/daily (scripts/daily-ootd.mjs 가 만든 그날 코디 그림). publicDir 는 프론트 아이콘용이라 따로 서빙 */
function dailyImages(): Plugin {
return {
name: 'daily-images',
configureServer(server) {
server.middlewares.use('/daily', (req, res, next) => {
const name = basename((req.url ?? '').split('?')[0])
const file = resolve(import.meta.dirname, 'public/daily', name)
if (!name.endsWith('.webp') || !existsSync(file)) return next()
res.setHeader('Content-Type', 'image/webp')
res.setHeader('Cache-Control', 'no-cache')
createReadStream(file).pipe(res)
})
},
}
}
// 각 아이콘·캐릭터는 서비스와 같은 파일을 쓴다 (/icons/*.png)
export default defineConfig({
plugins: [react(), tailwindcss(), planApi(), imageApi(), postApi()],
plugins: [react(), tailwindcss(), planApi(), imageApi(), postApi(), dailyImages()],
publicDir: '../frontend/public',
server: { port: 5175, strictPort: true },
})
+4 -4
View File
@@ -14,7 +14,7 @@ async def get_today_page(sido: str = Path(..., pattern=_SLUG), place: str = Path
err, html = await service.page(f"today/{sido}/{place}")
if err is not ErrorType.SUCCESS:
return HTMLResponse("not found", status_code=404)
return HTMLResponse(html, headers={"Cache-Control": "no-cache"})
return HTMLResponse(html, headers={"Cache-Control": "no-store"})
@router.get("/today/{sido}/{place}/{gu}", response_class=HTMLResponse, summary="구로 나뉜 시의 구 페이지 (/today/gyeonggi/seongnam/bundang)")
@@ -22,7 +22,7 @@ async def get_today_gu_page(sido: str = Path(..., pattern=_SLUG), place: str = P
err, html = await service.page(f"today/{sido}/{place}/{gu}")
if err is not ErrorType.SUCCESS:
return HTMLResponse("not found", status_code=404)
return HTMLResponse(html, headers={"Cache-Control": "no-cache"})
return HTMLResponse(html, headers={"Cache-Control": "no-store"})
@router.get("/tomorrow/{sido}/{place}", response_class=HTMLResponse, summary="지역 내일 날씨 페이지: 정적 HTML 에 내일 예보를 채운다 (nginx 가 /tomorrow/... 를 넘김)")
@@ -30,7 +30,7 @@ async def get_tomorrow_page(sido: str = Path(..., pattern=_SLUG), place: str = P
err, html = await service.page(f"tomorrow/{sido}/{place}")
if err is not ErrorType.SUCCESS:
return HTMLResponse("not found", status_code=404)
return HTMLResponse(html, headers={"Cache-Control": "no-cache"})
return HTMLResponse(html, headers={"Cache-Control": "no-store"})
@router.get("/tomorrow/{sido}/{place}/{gu}", response_class=HTMLResponse, summary="구로 나뉜 시의 구 내일 날씨 페이지")
@@ -38,4 +38,4 @@ async def get_tomorrow_gu_page(sido: str = Path(..., pattern=_SLUG), place: str
err, html = await service.page(f"tomorrow/{sido}/{place}/{gu}")
if err is not ErrorType.SUCCESS:
return HTMLResponse("not found", status_code=404)
return HTMLResponse(html, headers={"Cache-Control": "no-cache"})
return HTMLResponse(html, headers={"Cache-Control": "no-store"})