Skip to content

feat(spx-gui): support local reference images for generated assets - #3491

Open
CORCTON wants to merge 10 commits into
goplus:devfrom
CORCTON:feat/support-local-image-reference-2786
Open

CORCTON wants to merge 10 commits into
goplus:devfrom
CORCTON:feat/support-local-image-reference-2786

Conversation

@CORCTON

@CORCTON CORCTON commented Sep 7, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Add local reference-image upload for default sprite, costume, animation, and backdrop generation.
  • Let costume and animation generation switch between adopted costumes and retained local images; backdrop references remain optional.
  • Keep local images when switching presets and remove them only through explicit delete actions.
  • Remove local animation-reference backgrounds, then apply the same Kodo FOP used by generated costumes before video generation.
  • Persist reference files and task state, and cover upload cancellation and generation restoration.
  • Reuse the local-reference upload button and popover across default sprite and backdrop settings.
  • Extend AIGCBackdropSettings with optional referenceImageUrl.

Closes #2786

Backend dependency

Backdrop reference-image generation requires https://github.com/goplus/builder-backend/pull/371. Deploy the backend change before enabling this frontend behavior; older backends ignore referenceImageUrl and fall back to text-only backdrop generation.

Validation

  • vue-tsc --build --force
  • vitest --run src/models/spx/gen src/components/asset/gen/common/param-settings/ParamSelector.test.ts src/components/asset/gen/common/ReferenceImageButton.test.ts (139 tests)
  • ESLint on modified frontend files
  • Real Qiniu ImageService.Edit smoke test with a local reference image (4:3, one output); compared against the existing text-only path

fennoai[bot]

This comment was marked as outdated.

fennoai[bot]

This comment was marked as outdated.

fennoai[bot]

This comment was marked as outdated.

fennoai[bot]

This comment was marked as outdated.

@CORCTON

CORCTON commented Sep 20, 2026

Copy link
Copy Markdown
Collaborator Author

/review -claude

@fennoai fennoai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review: local image reference support

Solid, well-tested PR. The selection state is centralized in reference-image.ts, validation is applied consistently at the construct/set/save/load boundaries, and generation flows thread a merged AbortSignal through cleanly. The path-traversal guard in loadReferenceImageFile and the raw-Kodo-URL check in toCostumeReferenceImageUrl are nicely defensive and covered by tests. No blocking or correctness issues found — the notes below are maintainability/consistency items.

Non-blocking observations (not inlined):

  • The abort/cancel/merge-signal boilerplate in genImages/generate/runGenerateVideo + cancel() is now duplicated across all four *-gen.ts files (backdrop, sprite, costume, animation). Each repeats: abort the prior AbortController with a new Cancelled(...), cancel+dispose+null the prior task, create a fresh controller, mergeSignals(this.getSignal(), ctrl.signal), run the phase, and reset the field only if (this.xCtrl === ctrl). Only the Cancelled message differs. Worth extracting a shared helper so the four copies (and the subtle === ctrl guard) don't drift.
  • reference-image.ts allows SVG as a reference upload (imgExts includes svg). No active XSS today since previews flow through useFileUrl → object URL → <img>, but it's a latent stored-XSS surface if any future code renders the file via v-html/inline <svg>. Consider excluding SVG, or keep any rendering in a non-executing image context. Client-side type validation is extension/MIME-based only, so authoritative content validation should live server-side.

Comment thread spx-gui/src/models/spx/gen/img-process.ts Outdated
Comment thread spx-gui/src/models/spx/gen/img-process.ts Outdated
Comment thread spx-gui/src/models/spx/gen/animation-gen.ts
Comment thread docs/openapi.yaml Outdated

This branch was successfully deployed

1 active deployment
Preview – builder bd6e4877 Deployed Sep 21, 2026 by vercel[bot]
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.

Support (local) image as reference for costume / animation generation

2 participants