Skip to content

fix: restore Demo moderation and image creation - #485

Open
mvanhorn wants to merge 1 commit into
MacPaw:mainfrom
mvanhorn:fix/478-demo-moderation-image-creation
Open

mvanhorn wants to merge 1 commit into
MacPaw:mainfrom
mvanhorn:fix/478-demo-moderation-image-creation

Conversation

@mvanhorn

@mvanhorn mvanhorn commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

What

Moderation Chat rejects messages with an invalid-model error. Creating an image silently fails, leaving the user without an image, progress feedback, or an explanation. Moderation requests use the rejected text-moderation-latest model, while image creation omits the required model parameter. Image failures are only printed, and the view only handles URL responses, so it cannot display base64 image results.

Moderation now uses omni-moderation-latest, and ImageStore constructs image requests with gpt-image-1 and size options supported by that model. The image view displays progress, request errors, and decoded base64 images while retaining URL support. Starting a request cancels the previous subscription and clears stale results and errors; cancellation ends progress without displaying an error. The diff adds tests for request parameters, moderation success and failure, image errors, retries, base64 results, and cancellation.

Ran xcodebuild test -scheme DemoChat for MiscStoreTests and ImageStoreTests on an iPhone 17 simulator (iOS 26.4): 3 tests (11 test cases) pass with this change.
The moderation half has a runtime regression test: with the source changes reverted, MiscStoreTests compiles and fails because the request sends text-moderation-latest instead of omni-moderation-latest.
The image half is covered by ImageStoreTests, which call the new images(prompt:n:size:) entry point and read imagesQueryError. Those APIs do not exist on main, so these tests cannot run against the old code.

Refs #478

Why

The October 27 Demo release check (#478) found that Moderation Chat fails on every message and that image creation appears to do nothing. This covers those two items; the other observations in that report are left for follow-up.

Affected Areas

Demo app only: MiscStore.swift, ImageStore.swift and ImageCreationView.swift, plus the new MiscStoreTests.swift and ImageStoreTests.swift. No library code changes.

Moderation now uses omni-moderation-latest, and ImageStore constructs
image requests with gpt-image-1 and size options supported by that
model. The image view displays progress, request errors, and decoded
base64 images while retaining URL support. Starting a request cancels
the previous subscription and clears stale results and errors;
cancellation ends progress without displaying an error. The diff adds
tests for request parameters, moderation success and failure, image
errors, retries, base64 results, and cancellation.

Refs MacPaw#478
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