Text generation now runs through a PM2 automation worker (codex exec) and
images through the ChatGPT Chrome extension, replacing the Anthropic API.
generateStructured keeps its signature; results are Zod-validated on the web
side and the worker is reached with a bearer secret.
- AI image assistant in the post editor: editable prompt step, then image
(square or 3:2 only, since Instagram rejects 2:3), stored via putBlob
- Full-post queue (PostGenerationJob + migration): enqueue returns 202, FIFO
claim under an advisory lock, heartbeat, stale-job failure, per-user
request key, cancel while QUEUED; output is always a DRAFT with audit rows
- Separate 10 images/page/day quota; text quota excludes images
- Worker reports Codex usage-limit as 429 with a clear Thai message
- Docs: AI-AUTOMATION.md, ARCHITECTURE/README/.env.example updated
Known gap: the live FIFO queue check (scripts/check-post-queue.mjs) has not
passed yet; the last run hit the Codex account usage limit.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Facebook Login for Business (the only Login product a Business-type
app gets, needed here for Page/Messenger/Instagram) has no
email/public_profile permission to request, only business asset
permissions - there is no config_id that can resolve a user's
identity. credentials() now always returns null for facebook so the
button stays hidden; Google login is unaffected.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Replace Vercel-specific infra (Cron, Blob) with self-hosted equivalents
for deployment to Coolify: in-container cron scheduler
(scripts/cron-runner.mjs) and disk-based upload storage served via
/api/uploads/[...path]. Add Dockerfile, .dockerignore, and /api/health
for container health checks.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>