Skip to content

Add gemini-3.1-flash-image-preview (Nano Banana 2) support#137

Merged
ystknsh merged 2 commits intomainfrom
feature/add-gemini-3.1-flash-image-preview
Mar 2, 2026
Merged

Add gemini-3.1-flash-image-preview (Nano Banana 2) support#137
ystknsh merged 2 commits intomainfrom
feature/add-gemini-3.1-flash-image-preview

Conversation

@ystknsh
Copy link
Copy Markdown
Contributor

@ystknsh ystknsh commented Mar 2, 2026

概要

画像生成モデル gemini-3.1-flash-image-preview(Nano Banana 2)のサポートを追加。

  • src/tools/backend/types.ts - union 型に追加
  • src/components/settings/ImageGenSettings.vue - UI の選択肢・型に追加
  • src/views/HomeView.vue - 表示名の条件分岐に追加

参考

GitHub 検索結果

https://github.com/search?q=org%3Areceptron+gemini-3-pro-image-preview+OR+org%3Areceptron+gemini-2.5-flash-image++repo%3Areceptron%2FMulmoChat&type=code

Summary by CodeRabbit

  • New Features
    • Added Gemini 3.1 Flash Image model as a new option for image generation settings.
    • Extended backend configuration to support the new model variant.
    • Updated the UI to properly display and handle the new Gemini model selection.

…ions

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Mar 2, 2026

📝 Walkthrough

Walkthrough

Support for a new Gemini image generation model "gemini-3.1-flash-image-preview" is added across the UI settings component, backend type definitions, and view display logic to recognize and handle the new model variant.

Changes

Cohort / File(s) Summary
UI Settings Component
src/components/settings/ImageGenSettings.vue
Added "gemini-3.1-flash-image-preview" to the Gemini Model select options and extended the modelValue union type to support emitting the new model selection.
Backend Type Definitions
src/tools/backend/types.ts
Extended geminiModel type union in ImageGenerationConfigValue from two to three options, including the new "gemini-3.1-flash-image-preview" model.
View Logic
src/views/HomeView.vue
Added conditional branch to recognize "gemini-3.1-flash-image-preview" and display "Gemini 3.1 Flash Image" as the image model name.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Poem

A flash of light, so swift and new,
Three-point-one hops into our view,
The rabbit models, shiny bright,
Added 'cross the stack tonight! 🐰✨

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The pull request title accurately summarizes the main objective: adding support for a new Gemini image model (gemini-3.1-flash-image-preview).
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feature/add-gemini-3.1-flash-image-preview

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@ystknsh ystknsh changed the title Add gemini-3.1-flash-image-preview (Nano Banana 2) to image model opt… Add gemini-3.1-flash-image-preview (Nano Banana 2) support Mar 2, 2026
@ystknsh ystknsh marked this pull request as ready for review March 2, 2026 02:35
Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
src/components/settings/ImageGenSettings.vue (1)

122-125: Prefer deriving Gemini model type from ImageGenerationConfigValue to avoid drift.

This cast duplicates literal unions already defined in backend types. Reusing the source type will reduce future miss-sync risk.

♻️ Suggested refactor
 const handleGeminiModelChange = (event: Event) => {
-  const geminiModel = (event.target as HTMLSelectElement).value as
-    | "gemini-2.5-flash-image"
-    | "gemini-3.1-flash-image-preview"
-    | "gemini-3-pro-image-preview";
+  const geminiModel = (event.target as HTMLSelectElement)
+    .value as NonNullable<ImageGenerationConfigValue["geminiModel"]>;
   emit("update:modelValue", {
     ...normalizedConfig.value,
     geminiModel,
   });
 };
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/components/settings/ImageGenSettings.vue` around lines 122 - 125, Replace
the hard-coded literal union cast on the geminiModel assignment with the
backend-derived type: import the ImageGenerationConfigValue type and cast (or
narrow) the event target value to the appropriate member/union from
ImageGenerationConfigValue (e.g., the model field or an Extract<> of
ImageGenerationConfigValue) instead of the inline `"gemini-..."` union; update
the line that sets geminiModel in ImageGenSettings.vue to use
ImageGenerationConfigValue so the component stays in sync with backend types.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@src/components/settings/ImageGenSettings.vue`:
- Around line 122-125: Replace the hard-coded literal union cast on the
geminiModel assignment with the backend-derived type: import the
ImageGenerationConfigValue type and cast (or narrow) the event target value to
the appropriate member/union from ImageGenerationConfigValue (e.g., the model
field or an Extract<> of ImageGenerationConfigValue) instead of the inline
`"gemini-..."` union; update the line that sets geminiModel in
ImageGenSettings.vue to use ImageGenerationConfigValue so the component stays in
sync with backend types.

ℹ️ Review info

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 64f3bd8 and da9c1dc.

📒 Files selected for processing (3)
  • src/components/settings/ImageGenSettings.vue
  • src/tools/backend/types.ts
  • src/views/HomeView.vue

@ystknsh ystknsh merged commit da8f600 into main Mar 2, 2026
9 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