fix(imagegen): show diffusers version info and fix upgrade flow - #197
Merged
Merged
Conversation
Problem: The Diffuser upgrade UI did not display the current installed version or the latest available version. After upgrading, the button stayed enabled and version info was stale because the frontend never re-fetched the runtime status. Additionally, version constraints in package specs (e.g. "diffusers>=0.34.0") prevented --upgrade from actually picking up a newer release, so the upgrade silently did nothing. Changes: - Add DiffusersVersion and DiffusersLatestVersion fields to RuntimeStatus, populated by a new StatusWithVersions method. - installedPackageVersion: probe the venv Python for the installed diffusers version via importlib.metadata. - latestPyPIPackageVersion: query the configured mirror PEP 503 simple index page, or fall back to pypi.org JSON API, to find the latest version available from the installer actual package source. - stripVersionSpecs: strip version constraints from package specs before --upgrade so the latest version is installed. - InstallWithProgressOptions now returns StatusWithVersions so the frontend receives updated version info immediately after upgrade. - GET /api/image-runtime handler uses StatusWithVersions. - Frontend: fetch runtime status on page mount, show current/latest version, disable button and show Already upgraded when versions match, re-fetch status after upgrade to reflect the real installed version. - Add cache no-store to getImageRuntimeStatus to prevent stale responses. - Sync openapi/local-api.json schema with new response fields. - Add i18n keys for version labels and upgrade status messages.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Closes #196
The Diffuser upgrade feature had several issues:
diffusers>=0.34.0) caused--upgradeto consider the installed version as already satisfying the constraint, so no newer version was pulled.Fix
Backend (
internal/imagegen/runtime.go)StatusWithVersions()method enrichesStatus()with:installedPackageVersion()— probes venv Python viaimportlib.metadata.version()latestPyPIPackageVersion()— parses the configured mirror PEP 503 simple index page, falls back to pypi.org JSON APIstripVersionSpecs()— removes version constraints before--upgradeso the latest version is installedInstallWithProgressOptionsreturnsStatusWithVersionsafter upgrade so the frontend gets updated version info immediatelyBackend handler (
internal/server/handlers_images.go)/api/image-runtimeusesStatusWithVersionsFrontend (
web/src/pages/Settings.tsx,web/src/api/client.ts)getImageRuntimeStatususescache: "no-store"to prevent stale responsesAPI docs (
openapi/local-api.json)RuntimeStatusschema: addeddiffusers_versionanddiffusers_latest_versionfieldsi18n (
web/src/i18n.ts)Files changed
internal/imagegen/runtime.gointernal/server/handlers_images.goopenapi/local-api.jsoninternal/server/static/openapi/local-api.jsonweb/src/api/client.tsweb/src/i18n.tsweb/src/pages/Settings.tsxVerification
gofmt/go build/go vet/go test ./internal/server/— all passtsc --noEmit/vite build— pass