Skip to content

feat(ui): async batch generators & board -> image generator #7685

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 16 commits into from
Feb 26, 2025

Conversation

psychedelicious
Copy link
Collaborator

@psychedelicious psychedelicious commented Feb 25, 2025

Summary

Fixes the issues described in #7580, which enables the Dynamic Prompts string batch generators (previously disabled) and a generators that gets all images for a board.

The generator required a change to the boards router and services. We need to efficiently get a list of image names for all images or assets on a board, with no intermediates. The existing endpoint got both images and assets, and included intermediates. It is updated to get the data needed.

This API chane is similar to the one in #7682, but it doesn't get the full image DTO. Just image names - so no URLs need to be generated and the response is much smaller.

Related Issues / Discussions

Fixes issues described in #7580

QA Instructions

  • Try the dynamic prompts generators
  • Try the board -> image generator

Merge Plan

n/a

Checklist

  • The PR has a short but descriptive title, suitable for a changelog
  • Tests added / updated (if applicable)
  • Documentation added / updated (if applicable)
  • Updated What's New copy (if doing a release after this PR)

@github-actions github-actions bot added the frontend PRs that change frontend files label Feb 25, 2025
@github-actions github-actions bot added api python PRs that change python files invocations PRs that change invocations services PRs that change app services labels Feb 26, 2025
This fixes the broken readiness checks introduced in the previous commit.

To support async batch generators, all of the validation of the generators needs to be async. This is problematic because a lot of the validation logic was in redux selectors, which are necessarily synchronous.

To resolve this, the readiness checks and related logic are restructured to be run async in response to redux state changes via `useEffect` (another option is to directly subscribe to redux store). These async functions then set some react state. The checks are debounced to prevent thrashing the UI.

See #7580 for more context about this issue.

Other changes:
- Fix a minor issue where empty collections were also checked against their min and max sizes, and errors were shown for all the checks. If a collection is empty, we don't need to do the min/max checks. If a collection is empty, we skip the other min/max checks and do not report those errors to the user.
- When a field is connected, do not attempt to check its value. This fixes an issue where collection fields with a connection could erroneously appear to be invalid.
- Improved error messages for batch nodes.
The method and route now supports:
- "none" as a board ID, sentinel value for uncategorized
- Optionally specify image categories
- Optionally specify is_intermediate
…ndpoint

The functionality is the same - just need to explicitly opt out of categories and is_intermediate constraints.
This was a half-baked attempt to work around the issue with async generator nodes. It's not needed; the values are never referenced.
Not sure why I had this only checking if the size was >1. Doesn't make sense...
@psychedelicious psychedelicious marked this pull request as ready for review February 26, 2025 06:30
@psychedelicious psychedelicious force-pushed the psyche/feat/ui/async-batch-generators branch from 86b2ef7 to f762776 Compare February 26, 2025 06:30
@psychedelicious psychedelicious merged commit 43c2116 into main Feb 26, 2025
15 checks passed
@psychedelicious psychedelicious deleted the psyche/feat/ui/async-batch-generators branch February 26, 2025 07:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api frontend PRs that change frontend files invocations PRs that change invocations python PRs that change python files services PRs that change app services
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants