Repository navigation
feat(desktop): polish provider settings — bilingual copy, stable dialog height, full model checklist - #1051
Merged
Conversation
Provider catalog descriptions, custom-provider names, and badges now carry both zh and en copy, selected via detectUiLocale() in the display layer (PROVIDER_DISPLAY_COPY). The registry stays untouched; UI copy lives in provider-display. providerDisplay() keeps its call-site signature (locale is an optional param defaulting to detectUiLocale()), so the panel's description-based catalog search matches the current locale automatically. Brand names are never translated. Update the source-grep contract for the new localized structure.
The connection detail sheet jittered as the user pasted an API key: the 更新密钥 button was conditionally rendered on a dirty key draft, the 保存服务地址 button on a dirty endpoint, and the credential-status FieldDescription added/removed a line as the async hasSecret probe resolved. Each Save button is now always mounted and disabled until its field is dirty, and the credential hint is a single persistent line whose text changes per state without changing the line count. Real status changes (connection issue, OAuth notice) may still resize. Extend the canonical providers E2E journey to lock the invariant: open a connected provider's detail, record the dialog boundingBox height, type into the API key field, and assert the height is unchanged. Update the source-grep contracts for the persistent-but-disabled buttons and the single-line hint.
The enabled-model editor no longer hides the catalog behind a search box that only reveals unenabled models. It now renders every candidate model (buildCatalogModelChoices: live-fetched merged with fallback) as a persistent checkbox list inside a fixed-height OverlayScrollArea. Each row is a governed Item render-target button (role=checkbox); clicking it toggles the model through the existing enabledModelIds optimistic-update path, so a newly enabled model reaches the chat model picker with no side state. The default model row is checked and disabled (connectionEnabledModelIds always keeps it enabled), so it can't be clicked to no effect. Search filters the same list in place; an empty catalog shows a clear hint. The fixed-height region keeps the dialog height constant across providers and while filtering. Update the copy to match the new interaction (勾选的模型…/搜索模型) and adjust the source-grep + CSS contracts and the providers E2E journey.
…der token .providerCatalogSection's border-top referenced the undefined --border-subtle token (same class of bug as #1047), so the divider fell back to the initial border color. Point it at the defined --border token. No other --border-subtle references remain.
The zh/en localization landed with only the 15 providers from the old hardcoded switch; the other 29 catalog providers (cerebras, mistral, groq, openrouter, the tencent/stepfun/volcengine variants, …) fell back to the registry's English description, leaving them untranslated on the Chinese UI. Fill PROVIDER_DISPLAY_COPY with zh + en introduction copy (and badges) for all 44 CATALOG_PROVIDER_TYPES plus the OAuth account providers, in catalog order. Copy stays short and version-agnostic (who the provider is + how you connect), distinguishes same-brand variants (MiniMax 中国站, Tencent TokenHub vs Token Plan vs Coding Plan, the three StepFun access paths, OpenCode Zen vs Go), and never translates brand names. zh translates only the aggregator-family badges (聚合/网关/路由); Latin badges (API/Coding/Local/Custom/Plan/Token) stay as-is in both locales. Add provider-display-copy-contract.test.ts (data-driven over CATALOG_PROVIDER_TYPES, mirroring the icon-governance brand-mark completeness check): every catalog provider must carry non-empty zh AND en descriptions, zh must contain CJK, en must not — so a new provider cannot ship without bilingual copy. The registry fallback remains only for unknown persisted provider types.
…eds 85dvh The shared modal popup is `grid max-h-[85dvh] overflow-hidden` with no grid-template-rows, so the header/body rows size to content. When the connection detail outgrows the cap (e.g. Codex OAuth: issue banner + OAuth notice + expanded advanced settings with the fixed-height model list), the body row overflows the popup box and is clipped, and the body's own overflow-y:auto never engages (clientHeight==scrollHeight) — the bottom actions (保存服务地址/测试连接/删除连接) sit unreachable below the viewport. Verified against the live app via CDP at a 500px viewport: computed grid rows were 59.5px/750.125px inside a 425px popup with body scrollTop pinned to 0 and 删除连接 at bottom=831px. Pin `grid-template-rows: auto minmax(0, 1fr)` on the dialog-specific .providerConnectionDialog class (the shared MODAL_POPUP_CLASS is left untouched), so the body row shrinks at max height and takes over scrolling; measured rows become 59.5px/365.5px with the body scrollable to the bottom action. The absolutely positioned close button is out of grid flow and unaffected. Lock the invariant in the canonical providers E2E journey: shrink the viewport to 500px via CDP, assert the dialog stays within 85dvh and the viewport, the body is scrollable, and 删除连接 scrolls into view and opens its confirm. Without the fix the journey fails at the body-scrollable assertion (verified).
…g tabindex Every model row button was a Tab stop, so a large catalog (OpenRouter's fallback list is 260+ rows) walled off everything below the list for keyboard users. The list is now a composite widget with a roving tabindex: only the active row has tabIndex=0 (the rest -1), ArrowUp/ArrowDown/Home/End move the active row (focus scrolls it into view inside the fixed-height region), and Space/Enter toggle through the button's native activation. role=checkbox/aria-checked semantics and mouse behavior are unchanged; the disabled default-model row is natively unfocusable and arrow traversal skips it, consistent with Tab. Lock the invariant in the canonical providers E2E journey: one Tab from the search field lands inside the list on a checkbox row, a second Tab leaves the list, and ArrowDown + Space toggles the focused row. Verified the assertion catches the regression: with per-row tabIndex=0 the "second Tab leaves the list" step fails. Also drop two pieces of dead code: the data-enabled attribute on model rows (no consumer) and .providerModelChoiceRow's width:100% (the Item primitive base class already applies w-full).
…base URLs When hasFixedOAuthBaseUrl is true the endpoint field is readOnly with no dirty path, so the persistent 保存服务地址 button could never enable; render no providerEndpointActions row at all in that case. There is no jitter risk because the field cannot change. The API-key path keeps its always-mounted, disabled-until-dirty button (the height-stability contract). Sync the source-grep contracts: assert the OAuth branch renders no endpoint Save action, and update the model-list markup assertions for the roving-tabindex list introduced in the previous commit (multi-line <ul> with ref/onKeyDown, single roving tabIndex=0 row).
…completeness Extract PROVIDER_DISPLAY_COPY into provider-display-copy.ts, a React-free pure-data module typed `satisfies Record<ProviderType, Record<Locale, ProviderCopy>>` — a newly registered provider without a bilingual entry now fails the build instead of a runtime fallback. The locale type is declared locally (structurally identical to @maka/ui's UiLocale) so the module carries no UI dependency; the main-process test compilation path emits it to dist/renderer and imports it directly. Rewrite provider-display-copy-contract.test.ts to assert over the imported data instead of regex-parsing TSX source: keep the zh-must- contain-CJK / en-must-not check plus a non-empty check across all entries; drop the source-grep completeness scan (satisfies covers it at compile time). Register the new file in the provider settings combined source so the existing copy contracts keep seeing the copy text.
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
Three polish items for Settings → 模型, plus one token regression fix:
providerDisplay()now serves zh/en copy for every catalog provider via the existinguiLocalepreference (detectUiLocale()), same pattern as the other localized surfaces. A new completeness contract (provider-display-copy-contract.test.ts, modeled on the icon-governance brand-mark check) fails if a new catalog provider ships without non-empty zh + en descriptions, or if an entry's locale content is swapped.hasSecretstates (including a new "尚未设置密钥" state). Genuine status content (connection issues, OAuth notices) may still resize.EnabledModelManagernow persistently renders every candidate model (live-fetched merged with fallback viabuildCatalogModelChoices, plus enabled-but-uncatalogued ids so they stay removable) as a checkbox list inside a fixed-height (280px)OverlayScrollArea. Enabled models read as checked, clicking toggles through the existingenabledModelIdspath so newly enabled models reach the chat model picker immediately, the default model is checked + locked, and search filters the same list in place — so neither catalog size nor filtering changes the dialog height..providerCatalogSectionreferenced the undefined--border-subtle(same class of bug as fix(desktop): render provider-editor dividers via defined --border token #1047); nowvar(--border).Out of scope, deliberately: the connection dialog's form copy (模型密钥, 测试连接, …) stays Chinese-first as pinned by the existing a11y/copy contracts; localizing the whole dialog is a separate effort.
Verification
@maka/desktoptypecheck (main + renderer + storybook): clean@maka/desktopunit tests: 2542 pass / 0 fail (includes the new display-copy contract and updated model-oauth / settings-form-a11y / session-sticky-model / renderer-utility-primitives contracts)@maka/corebuild + provider-catalog contract: passcheck-copy/check-a11y/check-console: OK