Skip to content

feat(tools): support custom image generation models - #4142

Open
jiahe0510 wants to merge 1 commit into
mainfrom
jiahe/feat/custom-image-tool-model
Open

feat(tools): support custom image generation models#4142
jiahe0510 wants to merge 1 commit into
mainfrom
jiahe/feat/custom-image-tool-model

Conversation

@jiahe0510

Copy link
Copy Markdown
Collaborator

Description

Adds configurable image-generation model support to the built-in image generation tool.

  • Lets users select any model already configured under a model provider, without a separate custom-model visibility toggle.
  • Routes Gemini/OpenRouter chat-style image models through chat completions and OpenAI-compatible image families through the Images API.
  • Supports base64 and URL image results, including Microsoft MAI image endpoints.
  • Fixes the image generation enable switch so it remains actionable, validates missing model selection, and avoids redundant backend toggles.
  • Updates current Gemini fallback model IDs, supported-model guidance, and all locale resources.
  • Keeps provider credentials as the source of truth; this does not change the stored image-tool setting shape or require AionCore/AionCLI changes.

Related Issues

  • None

Type of Change

  • fix — Bug fix (non-breaking change which fixes an issue)
  • feat — New feature (non-breaking change which adds functionality)
  • perf — Performance improvement
  • refactor — Code restructuring (no behavior change)
  • Breaking change (fix or feature that would break existing functionality)
  • docs — Documentation update

Atomic PR Checklist (Rule 1)

  • This PR contains exactly one feature or bug fix that cannot be further decomposed
  • The PR title follows Conventional Commit format: <type>(<scope>): <subject> (English)

Local Checks (Rule 3)

  • bun run format — formatting passes
  • bun run lint — no lint errors (skip if no .ts/.tsx changed)
  • bunx tsc --noEmit — no type errors (skip if no .ts/.tsx changed)
  • bunx vitest run — tests pass
  • i18n validated (bun run i18n:types + node scripts/check-i18n.js) — only if src/renderer/, locales/, or src/common/config/i18n/ changed; N/A otherwise
  • New/changed user-facing text uses i18n keys (no hardcoded strings)

Runtime Verification

  • Verified on macOS
  • Verified on Windows
  • Verified on Linux
  • I have performed a self-review of my own code

Screenshots

Not included. The change is covered by focused DOM tests for model visibility and the image generation enable flow.

Additional Context

Validation through just push:

  • 497 test files passed, 1 skipped
  • 4,799 tests passed, 5 skipped
  • Lint completed with 0 errors
  • Formatting, TypeScript, and i18n checks passed

const baseUrl = provider.base_url.toLowerCase();
return (
baseUrl.includes('services.ai.azure.com/mai/v1') ||
(baseUrl.includes('services.ai.azure.com') && /^mai[-_/ ]?image/i.test(provider.use_model))
@codecov

codecov Bot commented Aug 22, 2026

Copy link
Copy Markdown

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