Repository navigation
Conversation
Part A — Settings full-page view:
- store: replace settingsOpen/openSettings/closeSettings with view enum
(AppView = 'workspace' | 'settings') and setView(v) action
- App.tsx: switch main area based on view instead of rendering a modal overlay
- Settings.tsx: remove modal shell, add ← Workspace back button; keep
AddProviderModal as a local dialog (not a page-level route)
- TopBar.tsx: gear button calls setView('settings')
- CommandPalette.tsx: Open Settings action calls setView('settings')
- ESC keybinding: view==='settings' → setView('workspace')
Part B — API switching pipeline audit + fix:
- ActiveModelSelector: add useEffect to sync local primary/fast state
when config prop changes, preventing stale models after provider switch
- The main pipeline (getApiKeyForProvider, getBaseUrlForProvider,
cachedConfig updates) audited and confirmed correct end-to-end
Tests (+6 new):
- store: setView switches view and closes command palette
- store: setView workspace/settings round-trip
- store: sendPrompt uses updated provider after completeOnboarding
- onboarding-ipc: getApiKeyForProvider returns decrypted key when secret exists
- onboarding-ipc: getApiKeyForProvider throws on missing provider secret
Signed-off-by: hqhq1025 <1506751656@qq.com>
When Settings is open and the command palette is also open, pressing ESC now closes the palette without navigating back to workspace. The escape handler in App.tsx previously checked `view === 'settings'` first; flip the priority so `commandPaletteOpen` is evaluated first. Three new store-level tests cover: palette consumed (view stays), plain settings-back, and no-op on workspace. Signed-off-by: hqhq1025 <1506751656@qq.com>
Replace the silent fallback in applyLocaleChange / handleLocaleChange with an error toast when window.codesign.locale is absent, so users know the language preference was not saved rather than silently losing it on restart. Signed-off-by: hqhq1025 <1506751656@qq.com>
Wire the previously-introduced errors.localePersistFailed and errors.rendererDisconnected locale keys into AppearanceTab's handleLocaleChange toasts (was hardcoded English). Addresses Codex review note that the new locale error keys remained unused. Signed-off-by: hqhq1025 <1506751656@qq.com>
…URL preview, single source of truth Rewrites the entire API config flow (add / view / edit / switch / delete provider). Foundation: - normalizeBaseUrl() in @open-codesign/shared: single canonical URL normalizer (Cherry Studio formatApiHost pattern). Trims, strips trailing slash, defaults to https. Never auto-appends /v1 (would corrupt Anthropic and ollama paths). - resolveModelsEndpoint(): smart endpoint builder that respects existing version segments instead of double-appending /v1. - enrichProviderError() in @open-codesign/providers: provider-aware error enrichment (Continue parseError + Aider ExInfo pattern). Each (status, provider) combo produces a tailored message + hint + provider key dashboard URL. Crucially never echoes the underlying SDK URL (api.openai.com leaked through relays). - pingProvider() now routes all errors through enrichProviderError so the same hints surface in Settings, onboarding, and the active connection test. UX: - AddProviderForm replaces the modal-in-modal AddProviderModal. Renders inline at top of provider list — no overlay stack. - Live URL preview below baseUrl input: shows resolved endpoint as user types, or the validation error reason for invalid input. - Live key format hint as user types (cross-family paste detection: catches Anthropic key pasted into OpenAI slot, etc.). - Save & Test unified button: validates first, only persists on success. Test button still available standalone. - ProviderCard now expands on click for details: full base URL + resolved endpoint shown without leaving the page. - Active provider banner at top of list with provider label badge. - All copy goes through useT() with new settings.providers.* keys (en + zh-CN). Reference: docs/research/19-api-config-ux-landscape.md
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.
Summary
Rewrites the entire API config flow (add / view / edit / switch / delete provider) addressing user pain: "从配置 api 到保存 api 再到查看 api 再到切换 api 再到添加 api 都跟一坨屎一样".
Based on research synthesized in
docs/research/19-api-config-ux-landscape.md(LibreChat / Open WebUI / Continue / Aider / Jan / Cherry Studio).Foundation (one source of truth)
normalizeBaseUrl()— single canonical URL normalizer in@open-codesign/shared(Cherry Studio formatApiHost pattern). Trims, strips trailing slash, defaults to https. Never auto-appends/v1(would corrupt Anthropic and ollama paths). Returns a discriminated union so the UI can render the failure reason inline.resolveModelsEndpoint()— smart endpoint builder that respects existing version segments instead of double-appending/v1.enrichProviderError()in@open-codesign/providers— provider-aware error enrichment (Continue parseError + Aider ExInfo pattern). Each(status, provider)combo produces a tailored message + actionable hint + provider key dashboard URL. Crucially never echoes the underlying SDK URL — fixes the "401 leaksapi.openai.comeven though the user is on a relay" bug class at the source.pingProvider()now routes all errors throughenrichProviderError, so the same enriched copy surfaces in Settings, onboarding, and the active connection test.checkKeyFormat()— live, lossless API-key sanity check (cross-family paste detection: catches Anthropic key pasted into the OpenAI slot, etc.).UX
AddProviderFormreplaces the modal-in-modalAddProviderModal. Renders inline at top of the provider list — no overlay stack, no z-index war.Will call: https://...), or the validation error reason for invalid input.useT()with newsettings.providers.*keys (en + zh-CN).Files of interest
packages/shared/src/baseUrl.ts(new) + testspackages/providers/src/errorEnrichment.ts(new) + testspackages/providers/src/validate.ts(rewritten to use both)apps/desktop/src/renderer/src/components/Settings.tsx(AddProviderForm + ProviderCard rewrite)apps/desktop/src/renderer/src/components/Settings/keyFormat.ts(new) + testspackages/i18n/src/locales/{en,zh-CN}.json(newsettings.providers.*block)Tests
normalizeBaseUrl(trailing slash / no protocol / IP / localhost / query / path with version segment / unsupported schemes)enrichProviderError(status × provider matrix, retry-after header parsing, URL leak prevention)checkKeyFormat(cross-family paste, too-short, prefix mismatch)resolveModelsEndpointTest plan
platform.openai.comURLsk-ant-...into OpenAI slot → orange "Expected prefix: sk-" hint appearsSwitched to <name>appears, banner updatesCompatibility / upgradeability / no bloat / elegance
ValidateKeyResultextended with optionalhint/providerKeyUrl/retryable(additive)normalizeBaseUrlandenrichProviderErrorare now the single chokepoints — future provider additions only touch these two filesXCircle,ChevronRight)