feat: 카드뉴스 포스트(관리자 admin/, /v1/card API, 피드 이미지 슬라이드), 인스타 홍보 기획 문서
This commit is contained in:
1 parent
96cbd19c61
commit
739a8c59eb
107 files changed
+17684
-19
No files matched your search
@@ -0,0 +1,41 @@
|
||||
import '../api/setup'
|
||||
import { loadCardData } from './data'
|
||||
import { neededImages } from './images'
|
||||
import { templateById } from './templates'
|
||||
import type { Copy } from './templates'
|
||||
|
||||
/** Claude 기획 요청에 넘기는 재료: 템플릿 설명·칸·지금 문구·오늘 날씨. 관리자 서버(/api/plan)가 불러 쓴다 */
|
||||
export async function planContext(templateId: string, current: Copy = {}) {
|
||||
const template = templateById(templateId)
|
||||
if (!template) throw new Error(`템플릿 '${templateId}' 이 없어요`)
|
||||
const d = await loadCardData()
|
||||
const defaults = template.defaults(d)
|
||||
return {
|
||||
template: { id: template.id, name: template.name, about: template.about, how: template.how },
|
||||
fields: template.fields,
|
||||
defaults,
|
||||
current: { ...defaults, ...current },
|
||||
weather: {
|
||||
date: d.dateLabel,
|
||||
headline: d.headline,
|
||||
morningC: d.morningC,
|
||||
maxC: d.maxC,
|
||||
minC: d.minC,
|
||||
rainy: d.rainy,
|
||||
오늘_각_점수: d.gaks.map((g) => ({ code: g.code, name: g.name, score: g.score, summary: g.summary })),
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
/** 이 카드에 아직 없는 그림 (all 이면 다시 그릴 그림 전부). 관리자 서버(/api/gen-image)가 쓴다 */
|
||||
export async function missingImages(templateId: string, copy: Copy = {}, all = false) {
|
||||
return neededImages(templateId, await loadCardData(), copy, all)
|
||||
}
|
||||
|
||||
/** 날씨각 피드 포스트 제목·설명 (npm run card --post 처럼 화면 밖에서 올릴 때) */
|
||||
export async function postText(templateId: string, copy: Copy = {}) {
|
||||
const template = templateById(templateId)
|
||||
if (!template) throw new Error(`템플릿 '${templateId}' 이 없어요`)
|
||||
const d = await loadCardData()
|
||||
return template.post(d, { ...template.defaults(d), ...copy })
|
||||
}
|
||||
Reference in new issue
Block a user