1.3 KiB
1.3 KiB
Web On The Fly
Flask app that streams AI-generated fake websites via SSE.
This is a Podman project. Use podman instead of docker for all container commands.
Commands
uv run app.py— start dev server on port 5000uv run pyright app.py— typecheck (strict mode in pyproject.toml)uv run ruff check app.py— lintuv run ruff check app.py --fix— auto-fix lint issues
Run lint/typecheck after any code changes.
Architecture
- Single file:
app.py /→ returns a loading page with spinner + live character counter/stream→ SSE endpoint; streams LLM output base64-encoded per chunk- Client JS buffers chunks in-memory (not localStorage), then replaces the document on
[DONE]
Env vars (loaded from .env via python-dotenv)
OPENAI_API_KEY— requiredOPENAI_API_URL— OpenAI-compatible endpoint (default: aipi.reeseapps.com)MODEL— model name (default: turbo)
Key details
- LLM is called with
stream=True; chunks are base64-encoded to avoid SSE protocol breaks - HTTP timeout is 300s (long generations)
- Themes defined in
THEMESlist: tuples of(site_type, description)(fake_store, fake_wiki, fake_social, etc.) pyrightis configured in strict mode; use# noqa: BLE001for intentional broad exception catches