Skip to content

feat(images): add MiniMax image generation - #456

Open
octo-patch wants to merge 1 commit into
OpenCoworkAI:mainfrom
octo-patch:octo/20261001-text-to-image-tool-recvwLZ6qjn7zQ
Open

octo-patch wants to merge 1 commit into
OpenCoworkAI:mainfrom
octo-patch:octo/20261001-text-to-image-tool-recvwLZ6qjn7zQ

Conversation

@octo-patch

Copy link
Copy Markdown

Reason: Enable MiniMax image generation in the existing generate_image_asset pipeline.

  • Add the image-01 adapter with global and China endpoints, Bearer authentication, aspect-ratio or size mapping, and validated base64 image results.
  • Add MiniMax image settings with regional selection and separate custom credentials; keep inherited text endpoints out of image requests.
  • Cover regional requests, image decoding, API errors, settings persistence, and tool option forwarding.

Validation:

  • corepack pnpm --filter @open-codesign/providers exec vitest run src/images.test.ts
  • corepack pnpm --filter @open-codesign/desktop exec vitest run src/main/image-generation-settings.test.ts
  • corepack pnpm lint
  • corepack pnpm typecheck
  • CI=1 corepack pnpm test
  • corepack pnpm --filter @open-codesign/desktop exec electron-vite build
  • git diff --check

API behavior is covered with mocked responses; no paid image generation request was made.

@github-actions github-actions Bot added docs Documentation area:desktop apps/desktop (Electron shell, renderer) area:providers packages/providers (pi-ai adapter, model calls) labels Oct 1, 2026

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Review mode: initial

Findings

  • [Minor] outputFormat is ignored for MiniMax but its control stays enabled — apps/desktop/src/renderer/src/components/settings/ImageGenerationTab.tsx:251 disables only the quality select for provider === 'minimax', while generateMiniMaxImage (packages/providers/src/images.ts:118) never reads options.outputFormat; the new test even passes outputFormat: 'webp' and still expects mimeType: 'image/png'. A user can therefore select a format that silently has no effect.
    Suggested fix: disable the Output format control when settings.provider === 'minimax' (same treatment as quality), or label that MiniMax controls the returned encoding.

  • [Minor] Switching away from MiniMax leaves credentialMode stuck at custom — apps/desktop/src/main/image-generation-settings.ts:367 forces custom only when moving to minimax and never restores the previous mode. The renderer then re-sends settings.credentialMode (now custom) for the next provider, so a user who previously relied on an inherited OpenAI/OpenRouter image key ends up in custom mode after a minimax round-trip.
    Suggested fix: restore the prior mode when leaving minimax, e.g. providerChanged && provider === 'minimax' ? 'custom' : providerChanged ? 'inherit' : current.credentialMode.

Questions

  • Does the MiniMax image_generation endpoint accept width/height? generateMiniMaxImage sends width/height (derived from size) whenever aspectRatio is absent, but only mocked responses were exercised ("no paid image generation request was made"). If MiniMax only accepts aspect_ratio, the size path is effectively dead — worth confirming the real request/response shape once.
  • Is the custom image key stored once per install or per provider? The settings view exposes a single hasCustomKey/maskedKey; if it is shared, a MiniMax custom key may be reused for OpenAI/OpenRouter requests after the switch above.

Summary

  • Review mode: initial
  • The MiniMax adapter (packages/providers/src/images.ts), regional base URLs and Bearer auth (packages/shared/src/config.ts), response/error validation, and the endpoint isolation from inherited text config look consistent with the existing OpenAI/OpenRouter adapters. Added Vitest cases cover the mocked paths, a changeset is present, and no new dependencies or direct SDK imports are introduced.
  • No blockers found. Residual risks are the unverified live request/response shape (especially width/height) and the credential-mode stickiness noted above.

Testing

  • Not run (automation). Suggested follow-ups: a Vitest case asserting outputFormat/quality are ignored for minimax at the option/UI layer, and one live (or recorded-fixture) MiniMax request to confirm width/height vs aspect_ratio.

Open-CoDesign Bot

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:desktop apps/desktop (Electron shell, renderer) area:providers packages/providers (pi-ai adapter, model calls) docs Documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant