Add brand visual style to page profile and logo palette to image prompts

Adds PageProfile.visualStyle (with migration), feeds it into every AI
prompt route, and samples a logo palette for image generation. Also
hardens Chrome focus handling and image copy in the ChatGPT driver.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
Loma Bot Ops
2026-11-23 20:58:06 +07:00
parent dc6ee09a55
commit 4c93bf0a11
18 changed files with 166 additions and 49 deletions
+1 -1
View File
@@ -38,7 +38,7 @@ export async function POST(req: Request) {
if (existing.pageId !== pageId || existing.topic !== topic || existing.targets.join() !== targets.join() || existing.plannedAt?.toISOString() !== plannedAt?.toISOString()) throw new UserFacingError("คำขอนี้ใช้กับงานอื่นแล้ว กรุณาสร้างคำขอใหม่");
return { job: existing, duplicate: true };
}
const page = await tx.page.findUnique({ where: { id: pageId }, select: { status: true, igUserId: true, profile: { select: { business: true, audience: true, tone: true, avoid: true, cta: true } } } });
const page = await tx.page.findUnique({ where: { id: pageId }, select: { status: true, igUserId: true, profile: { select: { business: true, audience: true, tone: true, visualStyle: true, avoid: true, cta: true } } } });
if (!page || page.status === "DISCONNECTED") throw new UserFacingError("ไม่พบเพจที่พร้อมสร้างโพสต์");
if (!page.profile?.business.trim()) throw new UserFacingError("ตั้งค่าโปรไฟล์ร้านก่อน เพื่อให้ AI สร้างโพสต์จากข้อมูลจริงของร้าน");
if (targets.includes("INSTAGRAM") && !page.igUserId) throw new UserFacingError("เพจนี้ยังไม่ได้ผูก Instagram");