Refactor code structure for improved readability and maintainability
This commit is contained in:
+19
-7
@@ -60,12 +60,21 @@ install the whole workspace). Do not commit `.env.local` (it's gitignored).
|
||||
**Server-only (optional — do NOT prefix with `NEXT_PUBLIC`):**
|
||||
| Name | Value |
|
||||
|---|---|
|
||||
| `GEMINI_API_KEY` | a Gemini key *(only for the AI generative-edit button)* |
|
||||
| `AI_EDIT_PROVIDER` | `runpod` *(or `local` / `huggingface` / `gemini` / `auto`)* |
|
||||
| `RUNPOD_API_KEY` | your RunPod API key *(shared by every RunPod endpoint)* |
|
||||
| `RUNPOD_SD_IMG2IMG_URL` | #10 prompt endpoint URL *(…/runsync)* |
|
||||
| `RUNPOD_SD_INPAINT_URL` | #9 masked sky/eraser/fill endpoint URL |
|
||||
| `RUNPOD_UPSCALE_URL` | #7 restore/upscale endpoint URL |
|
||||
| `RUNPOD_COLORIZE_URL` | #8 colorize endpoint URL |
|
||||
| `RUNPOD_YOLO_URL` | #1 detection endpoint URL *(+ `NEXT_PUBLIC_APG_RUNPOD_DETECT=true`)* |
|
||||
| `GEMINI_API_KEY` | a Gemini key *(alternative generative-edit backend)* |
|
||||
| `GEMINI_IMAGE_MODEL` | `gemini-2.5-flash-image` *(optional)* |
|
||||
|
||||
Without the Supabase vars the app still runs, but on browser-local storage only (data won't sync
|
||||
across devices). Without `GEMINI_API_KEY` the generative-edit route returns 503 while all the free
|
||||
in-browser AI keeps working.
|
||||
The RunPod URLs and `RUNPOD_API_KEY` are read **only** in the `/api/ai/*` route handlers (server
|
||||
side) — never send them to the browser (no `NEXT_PUBLIC_` prefix). Full endpoint map + the op →
|
||||
endpoint table is in [`docs/AI-SETUP.md`](./AI-SETUP.md). Without the Supabase vars the app still
|
||||
runs on browser-local storage; without any AI-edit provider the generative-edit route returns 503
|
||||
while all the free in-browser AI (detection, faces, OCR, background removal) keeps working.
|
||||
|
||||
Optional theming/feature flags (`NEXT_PUBLIC_APG_*`) are documented in [`docs/ENV.md`](./ENV.md).
|
||||
|
||||
@@ -90,9 +99,12 @@ they're intentionally not stored.
|
||||
|
||||
## Gotchas / limits (free tier)
|
||||
|
||||
- **Gemini AI edit + Vercel body limit:** Vercel Hobby caps request bodies at ~4.5 MB. The AI-edit
|
||||
route is capped accordingly and large images are downscaled client-side first; very large images
|
||||
may still be rejected. The free in-browser AI is unaffected.
|
||||
- **AI edit + Vercel body limit:** Vercel Hobby caps request bodies at ~4.5 MB. The AI-edit route is
|
||||
capped accordingly and large images are downscaled client-side first (≤1280 px). For masked SD 3.5
|
||||
ops the **image + mask share one body**, so they're budgeted together; a mask PNG is mostly flat
|
||||
black/white and compresses small, so this holds. Very large images may still be rejected. Prefer
|
||||
RunPod `/runsync` endpoints so a job returns within the 60 s function limit. The free in-browser AI
|
||||
is unaffected.
|
||||
- **Single-user demo:** the Supabase adapter does a full-state sync (no auth). For multi-user, add
|
||||
Supabase Auth and scope rows per user before going to production (the RLS policies are open for the
|
||||
demo — tighten them with `auth.uid()`).
|
||||
|
||||
Reference in New Issue
Block a user