Files
discord_bot/specs/SPEC-004-images.md
T

1.7 KiB

SPEC-004 — Image generation

Generation on image-model (default gpt-image-2), base64 end to end — no URL downloads, no expiring CDN links in the generation path. Optional knobs: image-size (default 1024x1024), image-quality (passed through only when set). The Leonardo path stays behind leonardo-token until parity is confirmed, then dies. The input pipeline (attachment cache, vision, edit/remix) is FDB-010 / IMG-10+.

IMG-01 — Images arrive as base64 buffers (coverage: test)

draw_openai(description, count) requests count images and returns a list of decoded image buffers straight from the API response; every generated image is metered in the ledger (SAF-05).

IMG-02 — The envelope carries picture_count (coverage: test)

The envelope gains picture_count (integer). post_process clamps it to 1..4 and defaults to 1 when absent (legacy history entries, old-model output). ENV-19's field list is revised accordingly.

IMG-03 — Multiple images, one message (coverage: test)

picture_count images are attached as multiple files to a single Discord send (the last part when the answer is split, per BEH-06).

IMG-04 — Legacy image models degrade safely (coverage: test)

When image-model is not a gpt-image-* model (e.g. dall-e-3), the count is clamped to 1 and response_format="b64_json" is requested explicitly (gpt-image models return base64 natively and reject the parameter).

IMG-05 — Picture prompts go to the API untouched (coverage: test)

The translate-before-draw step is deleted: the model's picture prompt reaches the image API verbatim (current image models handle Norwegian/German natively). The translate() method and its fix-model dependency are gone (closes D-009).