feat(AI): Replace Imagen with Nano Banana usage#985
feat(AI): Replace Imagen with Nano Banana usage#985DellaBitta wants to merge 3 commits intomasterfrom
Conversation
There was a problem hiding this comment.
Code Review
This pull request replaces the 'Imagen Generation' feature with a new 'Nano Banana' mode, transitioning from a dedicated image generation model to a generative model capable of interleaved text and image output. Key changes include updating the application state to support the nanobanana mode, adding aspect ratio selection and response modality controls in the sidebar, and implementing the NanoBananaView component. Feedback highlights a missing dependency in a useCallback hook within NanoBananaView.tsx which could lead to stale state usage, and a redundant state assignment in RightSidebar.tsx.
| setIsLoading(false); | ||
| setCurrentPrompt(""); | ||
| } | ||
| }, [currentPrompt, isLoading, currentParams, aiInstance]); |
There was a problem hiding this comment.
The handleImageGenerationSubmit callback uses selectedAspectRatio (line 84) but does not include it in the dependency array. This will cause the function to use the initial or stale value of the aspect ratio when submitted.
| }, [currentPrompt, isLoading, currentParams, aiInstance]); | |
| }, [currentPrompt, isLoading, currentParams, aiInstance, selectedAspectRatio]); |
| nextState.tools = [defaultGoogleSearchTool]; | ||
| nextState.generationConfig.responseMimeType = undefined; |
There was a problem hiding this comment.
There was a problem hiding this comment.
I think the bot is correct.
| nextState.tools = [defaultGoogleSearchTool]; | ||
| nextState.generationConfig.responseMimeType = undefined; |
There was a problem hiding this comment.
I think the bot is correct.
| <option key={level} value={level}> | ||
| {level.replace(/_/g, " ")} | ||
| <option value="">None</option> | ||
| {["1:1", "3:2", "2:3", "3:4", "4:3", "4:5", "5:4", "9:16", "16:9", "21:9"].map((ar) => ( |
There was a problem hiding this comment.
I thought we were only going to put a sample of aspect ratio text in the placeholder and not provide a UI select element? Is this because there are a limited number of aspect ratios that the model can handle?
There was a problem hiding this comment.
Yeah, it turns out that there's only a select set of supported aspect ratios. Seems easier to toy with if there's a pulldown, but I can remove the pull down and bake the aspect ratio into the sample prompts instead, if that's what you'd rather after all.
Update the
ai-react-appto:Use aspect ratio 21:9for instance.