Add scheduled automatic content drafts with Codex and image automation

This commit is contained in:
chaloemphong
2026-11-25 21:11:38 +07:00
parent 55235718c3
commit dd42b81639
13 changed files with 444 additions and 1 deletions
+1 -1
View File
@@ -76,7 +76,7 @@ export async function processNextPostJob(baseUrl: string) {
const logoPalette = await logoPalettePrompt(page.pictureUrl);
const content = await generateStructured({
kind: "post-generation", pageId: job.pageId, userId: job.requestedById,
system: SYSTEM, effort: "medium", schema: Draft, waitForWorker: true,
system: SYSTEM + (job.requestKey.startsWith("auto:") ? "\nThis is an automatic content slot. Choose a fresh, relevant topic from the shop profile and brief data. Avoid repeating the supplied recent topics. Never invent prices, promotions, availability or claims. The slot is creation time, not a publication promise." : ""), effort: "medium", schema: Draft, waitForWorker: true,
prompt: `${profilePrompt(profile)}\n${logoPalette}\n\n${platformRule(job.targets.includes("INSTAGRAM"))}\n\n<topic>\n${job.topic}\n</topic>`,
});
if (job.targets.includes("INSTAGRAM") && content.caption.length > 2200) throw new UserFacingError("Caption ที่ AI สร้างยาวเกินข้อจำกัด Instagram กรุณาลองใหม่");