Skip to content

fix: make API key optional for custom providers & sync nativeTheme for IME#236

Open
WqyJh wants to merge 1 commit into
mainfrom
mirror/pr-644
Open

fix: make API key optional for custom providers & sync nativeTheme for IME#236
WqyJh wants to merge 1 commit into
mainfrom
mirror/pr-644

Conversation

@WqyJh

@WqyJh WqyJh commented Jun 15, 2026

Copy link
Copy Markdown
Owner

Summary

Fixes XiaomiMiMo#529 and XiaomiMiMo#518.

1. Custom provider API key is now optional (XiaomiMiMo#529)

The custom provider wizard previously required an API key — pressing Enter with an empty value silently aborted the entire setup. This blocked users with local providers (e.g., llama.cpp, Ollama) that don't need authentication.

Changes:

  • Removed the if (!apiKey) return guard that blocked empty keys
  • Updated step prompt to say "API key (optional, Enter to skip)"
  • Made env array conditional — only added when a key is provided
  • Wrapped auth.set() call in if (apiKey) — skipped entirely for keyless providers

2. Sync Electron nativeTheme with app theme (XiaomiMiMo#518)

On Windows, when the system is in dark mode but the app is set to light mode, IME composition text (pre-input characters from Microsoft IME) appeared white on white — completely invisible.

Root cause: Electron's nativeTheme.themeSource defaulted to "system", so Chromium's internal dark mode flag followed the OS theme, not the app's CSS theme. On Windows, this flag influences how Microsoft IME (TSF) renders composition text.

Changes:

  • Added setNativeThemeSource() in windows.ts to set nativeTheme.themeSource
  • Added IPC handler set-native-theme in `ipc.ts"
  • Exposed setNativeTheme() in preload bridge and types
  • Renderer now calls window.api.setNativeTheme(mode) alongside setBackgroundColor whenever the theme changes

Closes XiaomiMiMo#529, closes XiaomiMiMo#518.


Mirrored from XiaomiMiMo/MiMo-Code#644 — original author @MrRealORG.

…r IME color

- XiaomiMiMo#529: Custom provider wizard no longer requires an API key.
  Users can press Enter to skip the key step for local providers.
  The env array and auth.set call are now conditional on key presence.

- XiaomiMiMo#518: Sync Electron's nativeTheme.themeSource with the app's theme
  mode so that IME composition text color matches the active theme.
  On Windows, Chromium's internal dark mode flag (from nativeTheme)
  influences how Microsoft IME renders composition text. Without this
  sync, a system-dark + app-light mismatch caused white IME text on a
  white background, making pre-input characters invisible.
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.

Can't add custom provider 浅色模式 预输入字符为白色 对比度极低 无法分辨

1 participant