Skip to content

feat(invoke): "Use as Ref Image" button + resilient auth fallback#220

Merged
lstein merged 1 commit intomasterfrom
lstein/feature/invoke-use-as-ref-image
Apr 17, 2026
Merged

feat(invoke): "Use as Ref Image" button + resilient auth fallback#220
lstein merged 1 commit intomasterfrom
lstein/feature/invoke-use-as-ref-image

Conversation

@lstein
Copy link
Copy Markdown
Owner

@lstein lstein commented Apr 17, 2026

Summary

  • Adds a third button to the InvokeAI metadata drawer (order: Remix, Recall, Use as Ref Image) that uploads the current image to InvokeAI via POST /api/v1/images/upload and then calls /api/v1/recall/{queue_id} with reference_images: [{image_name}]. The recall call intentionally omits strict=true so other parameters already set in InvokeAI are preserved.
  • Reworks the InvokeAI JWT auth flow so PhotoMap survives a backend switching between single-user and multi-user modes without needing a restart. The first attempt always uses whatever token is cached (or none); a 401 triggers a login + retry with Bearer; a 403 received with a token in hand (the "Multiuser mode is disabled. Authentication is not required…" case) invalidates the cache and retries anonymously.
  • All three drawer buttons remain gated by show_recall_buttons, so none render when no InvokeAI URL is configured.

Test plan

  • pytest tests/backend — 107 pass, including 5 new auth-fallback tests (test_invoke_router.py).
  • npm test — 233 pass, including new sendUseRefImage + button-click tests.
  • ruff check photomap tests — clean.
  • npm run lint + npm run format:check — clean.
  • Manual: against a running InvokeAI in multi-user mode, "Use as Ref Image" uploads and populates a reference image without resetting other params.
  • Manual: against a running InvokeAI in single-user mode with credentials still saved in PhotoMap, the first request succeeds anonymously (no 403 "Multiuser mode is disabled" error).
  • Manual: restart InvokeAI from multi-user → single-user while PhotoMap holds a cached token; verify the next recall silently retries anonymously and succeeds.

🤖 Generated with Claude Code

Adds a third button to the InvokeAI metadata drawer that uploads the
current image to InvokeAI and sets it as a reference image parameter,
without resetting any other generation parameters.

Also reworks the JWT auth flow so PhotoMap stays in sync with InvokeAI
when it is switched between single-user and multi-user modes: the first
request always uses whatever token is cached (or none), a 401 triggers
a login + retry with Bearer, and a 403 received with a token in hand
triggers an anonymous retry and discards the stale cache.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@lstein lstein enabled auto-merge (squash) April 17, 2026 04:20
@lstein lstein merged commit ff85098 into master Apr 17, 2026
6 checks passed
@lstein lstein deleted the lstein/feature/invoke-use-as-ref-image branch April 17, 2026 04:22
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