Playwright / README.md
hsmm's picture
Upload 4 files
f4f3994 verified

Doubao Web Worker (Playwright) for Dify

This Docker app exposes a minimal HTTP API for Dify workflow HTTP Request node:

  • POST /api/ask -> returns plain text answer
  • GET /api/health

If login/captcha is required, /api/ask returns HTTP 409 and a message containing:

  • /auth/qr.png (login screenshot with QR code)
  • /auth (helper page to refresh screenshot and optionally submit SMS code)

Required env vars (Hugging Face Space -> Settings -> Variables/Secrets)

  • WORKER_API_KEY (Secret): required. Dify sends it via X-Api-Key header.
  • PUBLIC_BASE_URL (Variable): optional but recommended, e.g. https://YOUR_SPACE.hf.space.
  • PROFILE_DIR (Variable): recommended /data/doubao_profile if you have a persistent disk.
  • DOUBAO_CHAT_URL (Variable): optional; default https://www.doubao.com/chat/.

Notes

  • Persistent session is the key to reduce verification frequency: keep cookies/localStorage in PROFILE_DIR.
  • This worker serializes requests with a lock because the browser profile is stateful.
  • Selectors may change. Adjust INPUT_SELECTOR, SEND_BTN_SELECTOR, ANSWER_SELECTOR if needed.