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
+14
-3
@@ -36,9 +36,11 @@ const feedback = flag('--feedback')
|
||||
const color = flag('--color')
|
||||
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 폴더]`)
|
||||
@@ -72,6 +74,17 @@ 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')
|
||||
const { outfits } = await runDailyOotd({ outDir })
|
||||
copy = Buffer.from(JSON.stringify({ ...decode(copy), 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 +107,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 = []
|
||||
|
||||
Reference in new issue
Block a user