feat: Google Gemini API による AI 画像強化機能の追加#14
Merged
Conversation
8 tasks
Agent-Logs-Url: https://github.com/jiuya/locksun/sessions/4ae3dab3-49f9-440e-bd5c-23578f6fba80 Co-authored-by: jiuya <6884687+jiuya@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Add Google Gemini API to enhance generated images
feat: Google Gemini API による AI 画像強化機能の追加
Apr 13, 2026
- types.rs の フィールドに serde(rename) を追加して camelCase に対応 - デフォルトモデルを gemini-2.5-flash-image に変更 - 429 Too Many Requests 時のリトライ処理を追加(最大3回、待機時間を解析して適用) - リクエスト URL フォーマットを修正(:generateContent 形式) - レスポンスをテキストで受け取り debug ログに出力するよう変更 - config/default_settings.toml に [gemini] セクションを追加 - generate_gemini_test.rs サンプルを追加
- src-tauri/config/user_settings.toml の api_key を空文字に修正 - git rm --cached で同ファイルをインデックスから除外 - .gitignore に src-tauri/config/user_settings.toml を追加 - テンプレートファイル user_settings.toml.example を新規作成 - config::load() で GEMINI_API_KEY 環境変数を優先するよう変更 - README に APIキーの安全な設定方法を追記 BREAKING: 漏洩した API キーは廃棄済み。新しいキーで再設定してください。
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.
rendererが生成する手続き的な空画像を Gemini マルチモーダル API に渡して写真的・リアル調に加工する機能を追加。gemini.enabled = falseまたはAPIキー未設定時は既存動作を維持する。新規モジュール:
src-tauri/src/gemini/types.rs—generateContentAPI のリクエスト/レスポンス serde モデルclient.rs—reqwestHTTPクライアント。APIキーは URL パラメータではなくx-goog-api-keyヘッダーで送信mod.rs— 公開 APIenhance_image()。disabled/空キー時は元バイト列をそのまま返すフォールバック設定 (
config/types.rs)GeminiConfigをAppConfigに追加。デフォルトenabled = false。スケジューラー (
scheduler/mod.rs)run_onceをasync fnに変更gemini.enabledかつキーあり の場合に AI 強化パスを通過Tauri コマンド
preview_image_enhancedコマンドを追加。画像生成 → Gemini 強化 → base64 DataURL を返す。フロントエンド
GeminiConfig型とpreviewImageEnhanced()ラッパーをtauri_commands.tsに追加<input type="password">、モデル名、プロンプト、有効トグル、AI強化プレビューボタン)