feat: regenerate AI post images with brand palette#57
Merged
Conversation
Let users adjust AI-generated slides in place via async job and Echo, while applying workspace brand, background, and text colors to image prompts. Autofill swaps site text/background colors for the image palette, and regeneration is blocked on finalized posts with safer job cleanup. Co-authored-by: Cursor <cursoragent@cursor.com>
- Added guidelines for AI agents to avoid embedding prompts in PHP and to store them in Blade files under `resources/views/prompts/`. - Updated `PostImageRegenerator` to render prompts using Blade instead of heredocs, improving maintainability and consistency with project standards. - Enhanced documentation in `CLAUDE.md` and `.cursor/rules` files to reflect these changes.
…nitions - Refactored the media item interface by moving it to a dedicated type file, enhancing code organization and reusability across components. - Updated various components to import the new MediaItem type, ensuring consistency and reducing redundancy in type definitions. - Improved the RegeneratePostMediaImage job by optimizing the media regeneration process and enhancing error handling for better reliability.
- Improved type definitions for regeneration status and event handling, increasing clarity and maintainability. - Streamlined the regeneration result handling by introducing a dedicated function to manage success and error states. - Added computed properties to optimize form submission logic, ensuring better user experience and validation. - Refactored the subscription logic to improve readability and error handling during media regeneration.
…sGuard - Replaced direct status checks in multiple controllers and actions with the PostStatusGuard utility, improving code readability and maintainability. - Updated error messages to utilize a centralized method for consistency across the application. - Removed the BrandImagePalette class, consolidating color resolution logic into the AiImageClient for better organization and type safety.
…ting and deletion checks - Removed the PostStatusGuard class and replaced its usage with the new PostStatusRules utility across multiple controllers and actions, enhancing code organization and maintainability. - Updated error message handling to utilize the centralized method in PostStatusRules, ensuring consistency in user feedback. - Deleted associated tests for PostStatusGuard, reflecting the removal of the class.
…ype safety - Replaced custom regeneration logic with a composable for improved organization and reusability. - Streamlined state management and error handling, enhancing clarity and maintainability. - Removed unused imports and interfaces, reducing code complexity and improving readability. - Updated computed properties for better form submission validation and user experience.
- Introduced a new `regenerate_image` boolean parameter in the PostImageRegenerator schema to control background image regeneration. - Updated relevant methods in RegeneratePostMediaImage and TemplateImageGenerator to utilize the new parameter for reusing existing backgrounds when appropriate. - Enhanced documentation and comments to clarify the usage of the `regenerate_image` option. - Added tests to ensure correct behavior when reusing background images.
…ration - Replaced the `regenerate_image` boolean with a `change_mode` string parameter in the PostImageRegenerator schema, allowing for more granular control over regeneration options. - Updated methods in RegeneratePostMediaImage to handle the new `change_mode` values: `image_only`, `text_only`, and `both`. - Enhanced documentation and comments to clarify the new regeneration logic. - Added tests to verify correct behavior for different regeneration modes, ensuring that text and image changes are handled appropriately.
- Added consistent imports of the MediaItem type across various components, including FacebookSettings, InstagramSettings, LinkedInSettings, PinterestSettings, PreviewTab, InstagramPreview, and PlatformPreview. - This change enhances code organization and ensures uniformity in type definitions throughout the project.
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.
Summary
Hardening
published,publishing, etc.)Test plan
php artisan teston PostAiRegenerateMedia, RegeneratePostMediaImageJob, BrandImagePalette, AiImageClient, UpdatePostRequestMade with Cursor