feat: 그날 코디 — 무신사 인기 스냅에서 사람별 코디 선정, Claude 옷 목록 추출, Codex 참고 사진 첨부 생성(npm run card -- ootd --daily), 카드 이름표 목록 2줄 허용
This commit is contained in:
1 parent
5cde680cb6
commit
814e64931d
14 files changed
+506
-50
No files matched your search
+12
-1
@@ -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))!
|
||||
|
||||
Reference in new issue
Block a user