Skip to content

Conversation

@riggaroo
Copy link
Collaborator

Also fix the cropped export image to not add clip when the image is aiBackground

This commit refactors the prompt used for image generation with edits.
The new prompt focuses on adding a background to the Android bot image while ensuring the bot remains the main subject, prominently featured in the foreground and center of the frame.
It also specifies that the bot should not be altered in shape or color and no new visual elements like hands, eyes, or mouths should be added.

The following changes were made:
- Renamed `generateImageWithEdit` to `addBackgroundToBot` in `ImageGenerationRepository` and `FirebaseAiDataSource` to better reflect its purpose.
- Updated the prompt in `ImageGenerationRepositoryImpl` to include detailed instructions for background addition and bot preservation.
- Updated `CustomizeExportViewModel` to use the new `addBackgroundToBot` method and the updated prompt.
@riggaroo riggaroo requested a review from tiwiz as a code owner August 11, 2025 17:27
Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Summary of Changes

Hello @riggaroo, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request enhances the AI background generation feature by allowing more precise control over the generated image, particularly in ensuring the main subject (the Android bot) remains prominent and unaltered. It achieves this by constructing a detailed prompt that includes specific instructions and constraints for the AI model. Additionally, it addresses a visual bug where AI-generated background images were incorrectly clipped during export, ensuring they are now displayed in full.

Highlights

  • Enhanced AI Background Generation: Introduced a new method addBackgroundToBot that constructs a highly detailed prompt for AI image generation. This prompt includes explicit instructions to ensure the Android bot remains the prominent, unaltered subject, effectively incorporating "negative" constraints to prevent unwanted modifications.
  • Fixed AI Background Image Clipping: Modified the image rendering logic to prevent the application of a rounded corner clip to exported images when an AI-generated background is used, ensuring the full image is displayed without unintended cropping.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in issue comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces a negative prompt for background generation by refactoring the prompt logic into the ImageGenerationRepository. It also fixes an issue where AI-generated backgrounds were incorrectly clipped. My review focuses on improving code style consistency and maintainability. I've pointed out a couple of minor style issues and a more significant suggestion to move the hardcoded AI prompt to a configurable source like Firebase Remote Config for better flexibility.

@riggaroo riggaroo merged commit 2aefcd2 into main Aug 12, 2025
4 checks passed
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.

2 participants