feat: 그날 코디 — 무신사 인기 스냅에서 사람별 코디 선정, Claude 옷 목록 추출, Codex 참고 사진 첨부 생성(npm run card -- ootd --daily), 카드 이름표 목록 2줄 허용

This commit is contained in:
minaChoi committed 2026-10-26 10:40:21 +09:00
1 parent 5cde680cb6
commit 814e64931d
14 files changed
+506 -50

No files matched your search

+7 -6
View File
@@ -133,7 +133,7 @@
top: 350px;
left: 80px;
width: 920px;
height: 800px;
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;
@@ -159,7 +159,7 @@
/* 그림 아래 옷 목록: 그림 속 위치에 기대지 않고 따로 적는다 */
.ootd-items {
position: absolute;
top: 1168px;
top: 1126px;
left: 80px;
right: 80px;
margin: 0;
@@ -168,13 +168,14 @@
display: flex;
flex-wrap: wrap;
justify-content: center;
gap: 10px;
align-content: flex-start;
gap: 8px;
}
.ootd-items li {
padding: 8px 18px;
padding: 7px 16px;
border-radius: 99px;
background: #fff;
font-size: 28px;
font-size: 26px;
font-weight: 700;
box-shadow: 0 6px 16px #28304a1f;
white-space: nowrap;
+12 -1
View File
@@ -3,7 +3,7 @@ import spec from '../../image-prompts/ootd.json'
/** 낮 최고기온 구간 × 스타일 × 사람별 옷. 옷 목록·카드 글자는 image-prompts/ootd.json 한 곳에서 정한다.
* 그림은 src/assets/ootd/<구간>-<사람>-<스타일>.webp 가 있으면 자동으로 붙는다 (npm run gen-image -- ootd <구간|스타일>).
* 일교차가 크면(OUTER_GAP_C 이상) 겉옷을 5번째 옷으로 그린 <구간>-<사람>-<스타일>-outer.webp 를 쓰고 이름표에도 겉옷을 더한다 */
export type Outfit = { persona: string; label: string; labels: string[]; outer: string; imageId: string; image?: string }
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' })
@@ -27,6 +27,17 @@ export function ootdBand(maxC: number) {
return OOTD_BANDS.find((b) => maxC >= b.from) ?? OOTD_BANDS[OOTD_BANDS.length - 1]
}
/** 그날 무신사 스냅에서 뽑은 코디 (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))!
+5 -4
View File
@@ -8,7 +8,7 @@ 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, needsOuter, 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>). 없으면 민무늬 배경
@@ -60,11 +60,12 @@ const ootd: Template = {
// 예시: 17~22도 캐주얼 (Codex 그림 6장)
example: { style: 'casual', band: 'mild', theme: 'berry' },
post: (d, c) => ({
title: `오늘의 코디 · ${styleLabel(c.style)}`,
title: dailyOutfits(c) ? '오늘의 코디' : `오늘의 코디 · ${styleLabel(c.style)}`,
caption: `낮 최고 ${d.maxC}도, 20대부터 40대~까지 오늘 입을 옷을 넘겨 보세요`,
hashtags: '#날씨각 #오늘의코디 #OOTD #데일리룩 #옷차림 #코디추천 #날씨 #오늘날씨 #서울날씨 #일상',
}),
warnings: (d, c) => {
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
@@ -72,11 +73,11 @@ const ootd: Template = {
: []
},
slides: (d, c) =>
ootdOutfits(d.maxC, c.style, c.band, needsOuter(d.maxC, d.morningC)).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 ? (