fix(broker): pass message.images through ai.chat for image-generation #68
No reviewers
Labels
No labels
prio_critical
prio_low
type_bug
type_contact
type_issue
type_lead
type_question
type_story
type_task
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
lhumina_code/hero_aibroker!68
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "development_mik"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Adds
images: Option<Vec<ResponseImage>>toproviders::types::Message, threaded from OpenRouter ApiMessage and the OpenAI provider, so image-output models round-trip cleanly throughai.chat.Without this fix,
herolib_ai::image_generation::parse_all_imageserrors"No images in response"on every image-gen call (e.g.google/gemini-3.1-flash-image-preview) because serde silently drops the unknownimagesfield on deserialize.Verified locally end-to-end with the matching hero_slides bucket-C PR: full slide generation through the broker produces a real PNG (≈1.3 MB) and the slides metadata correctly records the ADR-0007 inputs-hash snapshot.
Refs:
Signed-off-by: mik-tf
OpenRouter image-output models (e.g. google/gemini-3.1-flash-image-preview, google/gemini-3-pro-image-preview) return `message.images: [{type:"image_url", image_url:{url:"data:image/png;base64,..."}}]` in chat completions. The broker's typed `Message` struct had no `images` field, so serde silently dropped them on deserialize. The subsequent re-serialization in handle_ai_chat (openrouter shape) returned response bodies without `images`, and downstream `herolib_ai::image_generation::parse_all_images` errored "No images in response" — breaking every slide.generate call. Adds `images: Option<Vec<ResponseImage>>` to providers::types::Message and threads it through ApiMessage (openrouter.rs) and the OpenAI provider Message constructor. Verified end-to-end locally: hero_slides generates PNGs via Gemini Flash Image preview through this broker, with metadata round-tripping the ADR-0007 inputs-hash snapshot. Refs: lhumina_code/hero_slides#54 Signed-off-by: mik-tf