Skip to content

feat(invoke): reuse existing InvokeAI images instead of re-uploading#223

Merged
lstein merged 1 commit intomasterfrom
lstein/feature/invoke-reuse-existing-ref-image
Apr 23, 2026
Merged

feat(invoke): reuse existing InvokeAI images instead of re-uploading#223
lstein merged 1 commit intomasterfrom
lstein/feature/invoke-reuse-existing-ref-image

Conversation

@lstein
Copy link
Copy Markdown
Owner

@lstein lstein commented Apr 23, 2026

Summary

  • When the selected reference image looks InvokeAI-managed (UUID-style filename, or raw metadata with app_version / generation_mode / canvas_v2_metadata), probe GET /api/v1/images/i/{name} and skip the upload when InvokeAI already has the file — the recall is sent with the existing filename instead.
  • Non-Invoke images (no UUID name, no Invoke metadata) keep the original upload-then-recall path, so there's no extra round-trip for ordinary photos.
  • Probe failures (connection errors, auth issues, anything non-200) fall through to upload, so the optimization never breaks a request that would otherwise succeed.
  • Response payload now includes reused_existing: bool for observability; frontend already only checks response.ok.

Test plan

  • pytest tests — 134 backend tests pass, including 5 new use_ref_image tests covering UUID hit, UUID miss (404 → upload), metadata-based probe, non-Invoke skip, and probe-error fallthrough
  • npm test — 239 frontend tests pass
  • make lint — ruff + eslint + prettier clean
  • Manual: pick an image that originated from InvokeAI (UUID filename), click "Use as Ref Image", confirm recall succeeds with no duplicate appearing in the target board
  • Manual: pick a non-Invoke image (e.g. a phone photo), confirm upload-then-recall still works
  • Manual: with InvokeAI briefly unreachable mid-flow, confirm the request still falls through to upload cleanly

🤖 Generated with Claude Code

When the selected reference image looks like an InvokeAI-managed file
(UUID-style filename or Invoke generation metadata), probe
/api/v1/images/i/{name} first and, if InvokeAI already has the image,
send the recall parameters with the existing filename instead of
uploading a duplicate. Non-Invoke images continue to upload as before,
and any error from the probe falls through to the upload path so the
optimization never breaks a request that would otherwise succeed.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@lstein lstein enabled auto-merge (squash) April 23, 2026 14:36
@lstein lstein merged commit 61bc26e into master Apr 23, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant