Skip to content

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

Open
MrRealORG wants to merge 1 commit into
XiaomiMiMo:mainfrom
MrRealORG:fix/auto-202606150528-optional-apikey-ime-theme
Open

fix: make API key optional for custom providers & sync nativeTheme for IME#644
MrRealORG wants to merge 1 commit into
XiaomiMiMo:mainfrom
MrRealORG:fix/auto-202606150528-optional-apikey-ime-theme

Conversation

@MrRealORG

Copy link
Copy Markdown

Summary

Fixes #529 and #518.

1. Custom provider API key is now optional (#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 (#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 #529, closes #518.

…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