Back to Screenshot To Code

Images in Update History

design-docs/images-in-update-history.md

latest1.1 KB
Original Source

Images in Update History

Status: ✅ IMPLEMENTED

Multiple images in update history are fully supported in the backend.

Implementation

Core Function

  • create_message_from_history_item() in prompts/__init__.py handles image processing
  • User messages with images array create multipart content (images + text)
  • Assistant messages remain text-only (code)
  • Empty images arrays gracefully fallback to text-only

Supported Flows

  • ✅ Regular updates with images
  • ✅ Imported code updates with images
  • ✅ Multiple images per message
  • ✅ Backward compatibility (no images)

Tests

  • ✅ Single image in history (test_prompts.py)
  • ✅ Multiple images in history (test_prompts.py, test_prompts_additional.py)
  • ✅ Imported code with images (test_prompts.py, test_prompts_additional.py)
  • ✅ Empty images arrays (test_prompts_additional.py)

Usage

Frontend can send update history items with:

typescript
{
  text: "Update instructions",
  images: ["data:image/png;base64,img1", "data:image/png;base64,img2"]
}

Backend automatically creates proper multipart messages for AI models.