Skip to content

feat(chat): restore image previews in session history #59

Description

@dimakis

Problem

When navigating back to a previous session, user-attached images are not displayed. The conversation shows the text prompt but no image preview.

Root Cause

Images are staged to disk (.mitzo-images/) and the prompt is rewritten with file path references for the SDK. The SDK session history only stores the rewritten text — no image data. On restore, there's nothing to render as an image preview.

During a live session, the client holds preview data URLs in the images field of the user message and renders them inline. This state is lost on unmount/restore.

Options

  • A: Serve images via API — Add a /api/files/image endpoint that reads from .mitzo-images/. On restore, parse the file paths from the prompt text and render them as inline images. Leverages existing data on disk.
  • B: Store previews in session metadata — Save base64 preview thumbnails alongside the SDK session data (separate JSON file keyed by session ID). Restore reads them back. More self-contained but adds storage.

Option A is lighter and reuses what's already on disk.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions