6994ba1a4e
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>
44 lines
2.1 KiB
Bash
44 lines
2.1 KiB
Bash
DATABASE_URL="postgresql://user:pass@localhost:5432/page_manager"
|
|
# For prisma dev, use its separate shadow port; never point this at DATABASE_URL.
|
|
SHADOW_DATABASE_URL=""
|
|
SESSION_SECRET="" # long random string (jose HS256)
|
|
TOKEN_ENCRYPTION_KEY="" # any random string (hashed to a 32-byte key) — npm run gen-key works too
|
|
META_APP_ID=""
|
|
META_APP_SECRET="" # verifies webhook X-Hub-Signature-256
|
|
META_SYSTEM_USER_TOKEN="" # optional — pages can be connected via "Login with Facebook" instead
|
|
META_OAUTH_SCOPES="" # optional — override Facebook Login scopes (comma separated)
|
|
META_WEBHOOK_VERIFY_TOKEN="" # any random string, same value in App Dashboard
|
|
CRON_SECRET="" # also authenticates scripts/cron-runner.mjs inside the container
|
|
UPLOAD_DIR="" # optional — defaults to /app/.data/uploads; mount as a persistent volume
|
|
# Public URL incl. base path, no trailing slash (OAuth redirect URIs, webhook URL, upload URLs).
|
|
NEXT_PUBLIC_APP_URL="http://localhost:3000"
|
|
# Optional sub-path deploy, e.g. "/pagiva" for https://loma.chat/pagiva. Build-time: rebuild after changing.
|
|
NEXT_PUBLIC_BASE_PATH=""
|
|
|
|
# Optional — "เข้าสู่ระบบด้วย Google" on /login (button hidden when empty).
|
|
# "เข้าสู่ระบบด้วย Facebook" uses META_APP_ID / META_APP_SECRET above.
|
|
GOOGLE_CLIENT_ID=""
|
|
GOOGLE_CLIENT_SECRET=""
|
|
|
|
|
|
# Both Codex workers — auto-detect installed codex.exe on Windows when empty.
|
|
CODEX_BIN=
|
|
CODEX_MODEL=gpt-5.6-sol
|
|
|
|
|
|
# PM2 automation worker. Use HTTPS across machines.
|
|
AI_AUTOMATION_URL=http://127.0.0.1:4318/run
|
|
AI_AUTOMATION_SECRET=
|
|
AI_AUTOMATION_HOST=127.0.0.1
|
|
AI_AUTOMATION_PORT=4318
|
|
CHATGPT_PROFILE_DIR=.data/chatgpt-profile
|
|
CHATGPT_BROWSER_CHANNEL=chrome
|
|
# Windows: control an already-open normal Chrome via desktop accessibility.
|
|
# Other platforms: playwright uses the dedicated profile above.
|
|
CHATGPT_DRIVER=windows
|
|
CHATGPT_SURFACE=extension
|
|
CHATGPT_IMAGE_EXPORT=download
|
|
# Durable full-post queue. Same secret in the web app and queue polling worker.
|
|
POST_QUEUE_APP_URL=http://localhost:3000
|
|
POST_QUEUE_SECRET=
|