feat: 그날 코디 옷은 스냅에 태그된 무신사 상품만, 스타일 스냅을 더 받아 오고 후보 60개까지 봄(여성 스트릿 스냅 부족), buildPrompt 내보냄
This commit is contained in:
1 parent
7144084d8c
commit
ceacd5615b
3 files changed
+6
-5
No files matched your search
@@ -38,7 +38,7 @@ function layoutFor(slots) {
|
||||
return `top row: ${topRow}; bottom row: ${bottomRow}. Clearly separate spots, nothing else in between.`
|
||||
}
|
||||
|
||||
function buildPrompt(persona, outfit, weather) {
|
||||
export 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(', ')
|
||||
|
||||
@@ -43,9 +43,10 @@ function buildPrompt(pick, persona, weather) {
|
||||
goods,
|
||||
'',
|
||||
'규칙:',
|
||||
'- 자리(slot)는 top·bottom·shoes 는 반드시, 사진에서 겉옷(outer)을 입거나 걸쳤으면 outer 도, 가방이 있으면 bag 도 넣는다. 최대 5개, 자리마다 하나.',
|
||||
'- 태그된 상품에 있는 옷만 넣는다. 사진에 보여도 상품 목록에 없는 옷·가방은 넣지 않는다.',
|
||||
'- 자리(slot)는 top·bottom·shoes 는 반드시, 상품 목록에 겉옷이 있으면 outer 도, 가방이 있으면 bag 도 넣는다. 최대 5개, 자리마다 하나.',
|
||||
'- 원피스면 top 으로 넣고 bottom 은 생략하지 말고 같은 원피스를 bottom 에 다시 넣지 않는다 → 원피스는 top, bottom 자리에는 사진의 다른 하의가 없으면 shoes·bag 으로 4개를 채운다.',
|
||||
'- 상품 목록에 있는 옷은 그 상품명 기준으로, 없는 옷은 사진에서 보이는 대로. 색은 사진 기준.',
|
||||
'- 옷 이름은 상품명 기준, 색은 사진 기준.',
|
||||
'- label 은 카드 이름표라 짧고 쉬운 한글(브랜드·영어 금지). prompt 는 영어 한 구절, 색은 대문자.',
|
||||
'- style 은 코디 분위기 한 단어.',
|
||||
'JSON 으로만 답한다.',
|
||||
|
||||
@@ -170,7 +170,7 @@ export async function pickSnaps({ band, style, outDir, pages = 2, log = console.
|
||||
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 styleTags) add(await listSnaps({ tags: tag }, pages * 3))
|
||||
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)))
|
||||
@@ -186,7 +186,7 @@ export async function pickSnaps({ band, style, outDir, pages = 2, log = console.
|
||||
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)
|
||||
.slice(0, 60)
|
||||
let best = null
|
||||
for (const c of candidates) {
|
||||
const full = c.goods ? c : await withGoods(c)
|
||||
|
||||
Reference in new issue
Block a user