Commit Graph

7 Commits

Author SHA1 Message Date
imbytecat 9e6b4dc7fa feat: add 16:9 and 2K size presets for gpt-image-2
- Add 1536x864, 864x1536, 2048x1152, 1152x2048, 2560x1440 to the size
  dropdown. 2560x1440 is the OpenAI cookbook's recommended upper
  widescreen reliability boundary
- Note that sizes above 2560x1440 are experimental and the max-edge
  rule is strictly <3840 (3840x2160 is out, use 3824x2144 instead)
- 1920x1080 is invalid because 1080 isn't a multiple of 16 — captured
  in AGENTS.md alongside the full constraint set so future agents stop
  proposing it
2026-05-19 00:24:13 +08:00
imbytecat d5bbc14c8d feat: move base URL, API key, and model to server .env
- BASE_URL, API_KEY, MODEL now read from process.env (Bun auto-loads .env)
- requireEnv() fails fast at startup if any is missing
- request body simplifies to { prompt, size, referenceImages? }
- client drops the three fields from form and localStorage
- add .env.example as the variable-name source of truth
- AGENTS.md notes the 0.0.0.0 bind now exposes the upstream quota to
  anyone reachable on the network
2026-05-18 23:28:12 +08:00
imbytecat 4ef2f1ba2b fix: use image[] field for multi-reference edits
OpenAI documents the multipart array syntax as image[] for multiple
references; strict gateways reject repeated 'image' parts with
duplicate_parameter 400. Use 'image' for single, 'image[]' for 2+.
2026-05-18 23:22:42 +08:00
imbytecat 600f574b5c refactor: replace hand-rolled SSE with Hono + fetch-event-source
Server (index.ts):
- migrate to Hono streamSSE, mounted under Bun.serve fetch handler
- idleTimeout: 255 fixes the silent Bun 10s timeout that killed SSE
  responses before the first keepalive could fire (root cause of the
  empty EventStream tab)
- stream.onAbort wires an AbortController into upstream fetch signal
- 15s : keepalive raw SSE comments for Cloudflare 120s headroom
- decodeDataUrl returns Uint8Array<ArrayBuffer> for DOM Blob types
- chromeDevToolsAutomaticWorkspaceFolders: false silences the
  'Unable to add filesystem' warning in sandboxed browsers

Client (client.ts new):
- extracted from inline <script> — Bun only bundles external script src,
  not inline module imports, so node_modules bare specifiers must live
  in their own file
- @microsoft/fetch-event-source replaces hand-rolled fetch +
  ReadableStream parsing; supports POST + body + signal natively
- client aborts the loop on event:done so fetchEventSource doesn't retry

Build:
- drop unused react/react-dom/@types/react* deps (KISS)
- add 'DOM', 'DOM.Iterable' to tsconfig lib for client.ts
2026-05-18 23:13:06 +08:00
imbytecat 5af05b2141 feat: stream gpt-image generation via SSE with keepalive
- /api/generate now responds with text/event-stream end-to-end
- forwards upstream image_generation.* / image_edit.* partial+completed events
- 20s keepalive comments survive Cloudflare's 120s proxy-read timeout
- falls back to non-streaming when upstream rejects stream/partial_images
- drops @ai-sdk/openai-compatible, @ai-sdk/react, ai (unused)
- frontend consumes SSE via fetch+ReadableStream, shows progressive preview
2026-05-18 22:44:31 +08:00
imbytecat 54f13c1097 docs: document reference-images flow in AGENTS.md 2026-05-18 22:25:17 +08:00
imbytecat 0123661faf docs: add AGENTS.md 2026-05-18 22:13:16 +08:00