Add website link to page profile so the AI can read the shop site

Adds PageProfile.website (with migration). Codex runs without network, so
the profile draft route fetches the site server-side (public hosts only,
redirect-checked, size-capped, cached) and passes its text as
<shop_website>. Other prompts receive the URL via the shop profile.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
Loma Bot Ops
2026-11-23 21:20:35 +07:00
parent b592cd43f4
commit 5f8f0c9159
16 changed files with 184 additions and 35 deletions
+1
View File
@@ -63,3 +63,4 @@
ใช้ Prisma dev แยกสำหรับทดสอบ เก็บ TCP connection URL ของฐานนี้ไว้ที่ `.data/e2e/databaseUrl.txt` แล้วรัน `node scripts/check-ai-e2e.mjs --prepare` เพื่อสร้างค่า runtime ส่วนตัวและใช้ migration ที่มีอยู่ ไม่เปลี่ยน schema และไม่ใช้ฐาน production จากนั้นเปิด Next.js ที่พอร์ต 3107 โดยใส่ env จาก `.data/e2e/runtime.json` แล้วรัน `node scripts/check-ai-e2e.mjs` ต้องเปิด worker และ login ChatGPT extension ไว้ก่อน
หากขั้นภาพล้มเหลว แก้สาเหตุแล้วใช้ `node scripts/check-ai-e2e.mjs --resume` เพื่อใช้ fixture และผล Codex เดิม ไม่สร้างภาพซ้ำเมื่อมี image URL สำเร็จแล้ว เก็บข้อมูลทดสอบไว้ในฐานแยกเพื่อดูผลและรักษา audit log ผลลัพธ์อยู่ที่ `output/automation/e2e/`: `image.jpg`, `report.txt`, `result.json` และภาพ editor สองขนาด ส่วน `.data/e2e/` มี credentials และ session สำหรับทดสอบ ห้าม commit หรือแชร์
- เว็บไซต์ร้าน: โปรไฟล์ร้านมีช่อง `website` Codex รันแบบไม่มี tool/เครือข่าย จึงเปิดลิงก์เองไม่ได้ — ตอน "ให้ AI ร่างจากโพสต์เดิม" ฝั่ง server ดึงหน้าเว็บด้วย `src/lib/ai/website.ts` (เฉพาะ http/https พอร์ต 80/443, ปฏิเสธ localhost/IP ภายใน, ตรวจ DNS ทุก redirect สูงสุด 3 ครั้ง, อ่านไม่เกิน 1.5 MB, เฉพาะ HTML, cache 1 ชั่วโมง) แล้วส่งข้อความหน้าแรกไม่เกิน 6,000 ตัวอักษรเป็น `<shop_website>` ให้ Codex ใช้เป็นแหล่งข้อมูลที่สอง ส่วน prompt อื่นได้แค่ URL ผ่าน `<shop_profile>`