Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。
TypeScript agentai-agentai-assistantandroidclaude-codecodexelectroniosllmmacosreact-nativetypescriptwindows
fix(desktop): 模型供应商页与添加向导对齐 DESIGN.md 视觉规范 (#1102)
Kirozeng20e304d0ee94
diff --git a/apps/desktop/src/renderer/__tests__/addProviderWizardOpenAiAuth.test.tsx b/apps/desktop/src/renderer/__tests__/addProviderWizardOpenAiAuth.test.tsxindex 446038e5a2..2f9e3457cd 100644--- a/apps/desktop/src/renderer/__tests__/addProviderWizardOpenAiAuth.test.tsx+++ b/apps/desktop/src/renderer/__tests__/addProviderWizardOpenAiAuth.test.tsx@@ -352,3 +352,62 @@ describe('AddProviderWizard — OpenAI 授权边界', () => {});});});++describe('AddProviderWizard — 关闭途径(DESIGN.md §4:取消 / Esc / 遮罩)', () => {+ it('按 Esc 关闭向导', () => {+ const onClose = vi.fn();+ render(+ <AddProviderWizard+ providers={[OPENAI_PROVIDER]}+ onOpenCustomForm={vi.fn()}+ onClose={onClose}+ onDone={vi.fn()}+ />,+ );+ fireEvent.keyDown(window, { key: 'Escape' });+ expect(onClose).toHaveBeenCalledTimes(1);+ });++ it('输入法组合期间按 Esc 不关闭向导(取消候选词,不是关闭命令)', () => {+ const onClose = vi.fn();+ render(+ <AddProviderWizard+ providers={[OPENAI_PROVIDER]}+ onOpenCustomForm={vi.fn()}+ onClose={onClose}+ onDone={vi.fn()}+ />,+ );+ fireEvent.keyDown(window, { key: 'Escape', isComposing: true });+ expect(onClose).not.toHaveBeenCalled();+ fireEvent.keyDown(window, { key: 'Escape', keyCode: 229 });+ expect(onClose).not.toHaveBeenCalled();+ fireEvent.keyDown(window, { key: 'Escape' });+ expect(onClose).toHaveBeenCalledTimes(1);+ });++ it('点击遮罩关闭向导;点击弹窗内部不关闭', () => {+ const onClose = vi.fn();+ const { container } = render(+ <AddProviderWizard+ providers={[OPENAI_PROVIDER]}+ onOpenCustomForm={vi.fn()}+ onClose={onClose}+ onDone={vi.fn()}+ />,+ );+ // 点弹窗内部(标题):target ≠ 遮罩本身,不得关闭。+ fireEvent.click(screen.getByText('settings.providers.wizard.title'));+ expect(onClose).not.toHaveBeenCalled();+ const overlay = container.firstElementChild as HTMLElement;+ // 从弹窗内部按下、拖出到遮罩松开:合成 click 落在遮罩,但按下不始于遮罩,+ // 不得误关(防丢表单)。+ fireEvent.mouseDown(screen.getByText('settings.providers.wizard.title'));+ fireEvent.click(overlay);+ expect(onClose).not.toHaveBeenCalled();+ // 按下与松开都在遮罩上:关闭。+ fireEvent.mouseDown(overlay);+ fireEvent.click(overlay);+ expect(onClose).toHaveBeenCalledTimes(1);+ });+});diff --git a/apps/desktop/src/renderer/components/settings/AddProviderWizard.tsx b/apps/desktop/src/renderer/components/settings/AddProviderWizard.tsxindex 394b54976c..ecc816ba63 100644--- a/apps/desktop/src/renderer/components/settings/AddProviderWizard.tsx+++ b/apps/desktop/src/renderer/components/settings/AddProviderWizard.tsx@@ -14,14 +14,13 @@* 上探测式灰态)。*/-import { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState } from 'react';+import { useCallback, useEffect, useMemo, useRef, useState } from 'react';import { useTranslation } from 'react-i18next';-import { Check, Info, Plus, Search, X } from 'lucide-react';+import { Check, Info, Plus, Search } from 'lucide-react';import { cn } from '@/lib/utils';import { toast } from '@/lib/toast';import { Spinner } from '@/components/ui/spinner';-import { Tip } from '@/components/ui/tooltip';import { createCustomProvider, type RuntimeKeys } from '@/lib/customProviders';import { PROVIDER_SECRET_IDS } from '../../../shared/providerSecrets';import { uniqueCustomProviderId } from '@/lib/customProviderId';@@ -178,49 +177,14 @@ function cardIcon(sel: { providerId?: string; name: string }): React.ReactNode {if (sel.providerId && hasProviderLogo(sel.providerId)) {return <ProviderLogoMark providerId={sel.providerId} size={15} />;}- return <span className="text-12 font-semibold leading-none">{providerMonogram(sel.name)}</span>;+ return <span className="text-12 font-medium leading-none">{providerMonogram(sel.name)}</span>;}-/** 单行供应商名;只有实际发生截断时才在 hover 后展示完整名称。 */-function ProviderCardName({ name }: { name: string }) {- const nameRef = useRef<HTMLSpanElement>(null);- const [truncated, setTruncated] = useState(false);-- useLayoutEffect(() => {- const element = nameRef.current;- if (!element) return;- const measure = () => setTruncated(element.scrollWidth > element.clientWidth + 1);- measure();- if (typeof ResizeObserver === 'undefined') {- window.addEventListener('resize', measure);- return () => window.removeEventListener('resize', measure);- }- const observer = new ResizeObserver(measure);- observer.observe(element);- // Tip 启停会改变子树并重挂 span,truncated 变化时必须把 observer 绑定到新节点。- return () => observer.disconnect();- }, [name, truncated]);-- const text = (- <span- ref={nameRef}- className="min-w-0 truncate text-13 font-medium"- style={{ color: 'var(--settings-section-title)' }}- >- {name}- </span>- );-- return truncated ? (- <Tip text={name} delay={250} contentClassName="z-[10001] max-w-[320px] [word-break:normal]">- {text}- </Tip>- ) : (- text- );-}--function ProviderCard({+/**+ * 目录单行(2026-07 定稿:第 1 步由三列卡片宫格改为单列列表)——名称在左、+ * 鉴权方式靠右;行宽给足后不再需要截断测量 + Tip 组合。+ */+function ProviderRow({icon,name,meta,@@ -235,26 +199,27 @@ function ProviderCard({<buttontype="button"onClick={onClick}- className="flex flex-col gap-1 rounded-xl border p-3 text-left transition-colors hover:bg-[var(--surface-hover)]"- style={{- borderColor: 'var(--border-default)',- backgroundColor: 'var(--surface-elevated)',- }}+ title={name}+ className="flex w-full items-center gap-2.5 rounded-lg px-2 py-[7px] text-left transition-colors hover:bg-[var(--surface-hover)]">- <span className="flex items-center gap-2">- <span- className="flex h-6 w-6 shrink-0 items-center justify-center rounded-md"- style={{- backgroundColor: 'var(--settings-integration-avatar-bg)',- border: '1px solid var(--settings-integration-avatar-border)',- color: 'var(--settings-integration-avatar-icon)',- }}- >- {icon}- </span>- <ProviderCardName name={name} />+ <span+ className="flex h-7 w-7 shrink-0 items-center justify-center rounded-lg"+ style={{+ backgroundColor: 'var(--settings-integration-avatar-bg)',+ border: '1px solid var(--settings-integration-avatar-border)',+ color: 'var(--settings-integration-avatar-icon)',+ }}+ >+ {icon}</span>- <span className="truncate text-11" style={{ color: 'var(--text-tertiary)' }}>+ <span+ className="min-w-0 flex-1 truncate text-13 font-medium"+ style={{ color: 'var(--settings-section-title)' }}+ >+ {name}+ </span>+ {/* meta 可收缩截断:en 等长文案在窄弹窗下不得把名称挤出(PR #1102 review)。 */}+ <span className="min-w-0 truncate text-11" style={{ color: 'var(--text-tertiary)' }}>{meta}</span></button>@@ -273,8 +238,8 @@ function InfoLine({ text }: { text: string }) {function GroupLabel({ children }: { children: React.ReactNode }) {return (<span- className="pb-1.5 pt-3 text-11 font-semibold uppercase"- style={{ color: 'var(--text-tertiary)', letterSpacing: '0.4px' }}+ className="block px-2 pb-1.5 pt-3 text-11 font-medium uppercase"+ style={{ color: 'var(--text-tertiary)', letterSpacing: '0.5px' }}>{children}</span>@@ -537,6 +502,23 @@ export function AddProviderWizard({onClose();}, [loggingIn, cancelAuthorize, onClose]);+ // 遮罩关闭的防误触:从输入框按下、拖到弹窗外松开时,浏览器把合成 click 派发到+ // 按下点与松开点的最近公共祖先(= 遮罩),target === currentTarget 成立但用户+ // 并无关闭意图。记录按下是否始于遮罩,按下与松开都在遮罩上才关闭+ // (PR #1102 review 第七轮)。+ const overlayMouseDownOnSelfRef = useRef(false);++ // Esc 关闭(DESIGN.md §4:弹窗关闭 = 取消按钮 / Esc / 点遮罩;本弹窗未用 Radix,需自行监听)。+ // CJK 输入法组合期间的 Esc 是「取消候选词」,不是关闭命令(isComposing / 遗留+ // keyCode 229),与仓库其他 CJK 输入场景同口径(PR #1102 review 第六轮)。+ useEffect(() => {+ const onKeyDown = (e: KeyboardEvent) => {+ if (e.key === 'Escape' && !e.isComposing && e.keyCode !== 229) handleClose();+ };+ window.addEventListener('keydown', onKeyDown);+ return () => window.removeEventListener('keydown', onKeyDown);+ }, [handleClose]);+// OpenAI 走 useCodexAuth:hook 状态翻 connected 时视为完成(triggerLogin 也会返回,// oneshot ref 保证只收口一次)。只收口本向导内发起的登录(openaiLoginStartedRef),// 不把「本机已有凭证」误当成完成 —— 见 openaiLoginStartedRef 的注释。@@ -841,8 +823,11 @@ export function AddProviderWizard({}}, [sel, picks, name, apiKey, presetBaseUrls, providers, onDone, t, i18n.language]);- // ── 步骤指示(OAuth 路径只有 2 步)─────────────────────────────────────- const totalSteps = sel?.kind === 'preset' ? 3 : 2;+ // ── 步骤指示 ─────────────────────────────────────────────────────────+ // 目录步默认按完整路径显示三步(选择供应商 → 连接 → 选择模型);选中真的+ // 没有第 3 步的两步流程(OAuth 授权即完成、内置 API Key 保存即连接)才收成+ // 两步。未选择时就显示两步会让「选择模型」凭空消失/出现(2026-07-30 用户反馈)。+ const totalSteps = sel == null || sel.kind === 'preset' ? 3 : 2;const stepLabels = [t('settings.providers.wizard.stepPick'),t('settings.providers.wizard.stepConnect'),@@ -903,41 +888,40 @@ export function AddProviderWizard({(!presetNeedsApiKey || apiKey.trim().length > 0);return (- <div className="fixed inset-0 z-[10000] flex items-center justify-center bg-[var(--overlay-modal)]">+ // DESIGN.md §4 Dialog:关闭 = 底部「取消」/ Esc / 点遮罩,不设右上角 ×(与 ConfirmDialog 同构)。+ <div+ className="fixed inset-0 z-[10000] flex items-center justify-center bg-[var(--overlay-modal)]"+ onMouseDown={(e) => {+ overlayMouseDownOnSelfRef.current = e.target === e.currentTarget;+ }}+ onClick={(e) => {+ if (e.target === e.currentTarget && overlayMouseDownOnSelfRef.current) handleClose();+ overlayMouseDownOnSelfRef.current = false;+ }}+ ><div- className="flex max-h-[85vh] w-[600px] flex-col overflow-hidden rounded-xl border"+ className="flex max-h-[min(640px,85vh)] w-[min(600px,calc(100vw-32px))] flex-col overflow-hidden rounded-xl border"style={{backgroundColor: 'var(--surface-elevated)',borderColor: 'var(--border-default)',}}>- {/* 头部:标题 + 步骤指示 */}- <div className="flex flex-col gap-3 px-6 pb-4 pt-5">- <div className="flex items-center justify-between">- <h3- className="text-16 font-semibold"- style={{ color: 'var(--settings-section-title)' }}- >- {sel- ? t('settings.providers.wizard.titleWith', {- name:- sel.kind === 'preset'- ? presetDisplayName(sel.preset, i18n.language)- : sel.provider.name,- })- : t('settings.providers.wizard.title')}- </h3>- <button- type="button"- onClick={handleClose}- aria-label={t('settings.providers.wizard.closeAria')}- className="flex h-7 w-7 items-center justify-center rounded-md transition-colors hover:bg-[var(--surface-hover)]"- style={{ color: 'var(--text-tertiary)' }}- >- <X size={16} />- </button>- </div>- <div className="flex items-center gap-4">+ {/* 头部:标题居左 + 步骤指示居右,同一行(2026-07 定稿原型形态)。 */}+ <div className="flex items-center justify-between gap-4 px-4 pb-3 pt-4">+ <h3+ className="min-w-0 truncate text-16 font-medium"+ style={{ color: 'var(--settings-section-title)' }}+ >+ {sel+ ? t('settings.providers.wizard.titleWith', {+ name:+ sel.kind === 'preset'+ ? presetDisplayName(sel.preset, i18n.language)+ : sel.provider.name,+ })+ : t('settings.providers.wizard.title')}+ </h3>+ <div className="flex shrink-0 items-center gap-4">{stepLabels.map((label, i) => {const n = i + 1;const isCur = n === step || (n === totalSteps && step > totalSteps);@@ -977,37 +961,52 @@ export function AddProviderWizard({</div></div>- {/* 主体 */}+ {/* 主体。第 1 步是「固定搜索 + 限高滚动目录 + 钉底自定义入口」的三段结构+ (滚动区上下以 1px Board 细线与固定区分隔,自定义端点不随目录滚动);+ 第 2/3 步保持整体滚动的表单区。 */}<div- className="min-h-[320px] flex-1 overflow-y-auto border-t px-6 py-4"+ className={cn(+ 'min-h-[320px] flex-1',+ step === 1 ? 'flex min-h-0 flex-col overflow-hidden' : 'overflow-y-auto border-y px-4 py-4',+ )}style={{ borderColor: 'var(--border-default)' }}>{step === 1 && (- <div className="flex flex-col">- <div- className="flex h-9 items-center gap-2 rounded-full border px-3.5"- style={{- borderColor: 'var(--border-default)',- backgroundColor: 'var(--surface-elevated)',- }}- >- <Search size={14} className="shrink-0" style={{ color: 'var(--text-tertiary)' }} />- <input- type="text"- value={query}- onChange={(e) => setQuery(e.target.value)}- placeholder={t('settings.providers.wizard.searchPlaceholder')}- className="min-w-0 flex-1 bg-transparent text-13 outline-none placeholder:text-[var(--text-placeholder)]"- style={{ color: 'var(--settings-section-title)' }}- />+ <>+ <div className="px-4 pb-3">+ <div+ className="flex h-9 items-center gap-2 rounded-full border px-3.5"+ style={{+ borderColor: 'var(--border-default)',+ backgroundColor: 'var(--surface-elevated)',+ }}+ >+ <Search+ size={14}+ className="shrink-0"+ style={{ color: 'var(--text-tertiary)' }}+ />+ <input+ type="text"+ value={query}+ onChange={(e) => setQuery(e.target.value)}+ placeholder={t('settings.providers.wizard.searchPlaceholder')}+ className="min-w-0 flex-1 bg-transparent text-13 outline-none placeholder:text-[var(--text-placeholder)]"+ style={{ color: 'var(--settings-section-title)' }}+ />+ </div></div>- {filteredOauth.length > 0 && (- <>- <GroupLabel>{t('settings.providers.wizard.groupSubscription')}</GroupLabel>- <div className="grid grid-cols-3 gap-2">+ {/* 目录:单列列表(2026-07 定稿,替代三列卡片宫格),唯一的滚动区。 */}+ <div+ className="min-h-0 flex-1 overflow-y-auto border-y px-2 pb-2"+ style={{ borderColor: 'var(--border-default)' }}+ >+ {filteredOauth.length > 0 && (+ <>+ <GroupLabel>{t('settings.providers.wizard.groupSubscription')}</GroupLabel>{filteredOauth.map((p) => (- <ProviderCard+ <ProviderRowkey={p.id}icon={cardIcon({ providerId: p.id, name: p.name })}name={p.name}@@ -1019,18 +1018,16 @@ export function AddProviderWizard({onClick={() => pickOauth(p)}/>))}- </div>- </>- )}+ </>+ )}- {(filteredPresets.length > 0 || builtinApiKeyChoices.length > 0) && (- <>- <GroupLabel>{t('settings.providers.wizard.groupApiKey')}</GroupLabel>- <div className="grid grid-cols-3 gap-2">+ {(filteredPresets.length > 0 || builtinApiKeyChoices.length > 0) && (+ <>+ <GroupLabel>{t('settings.providers.wizard.groupApiKey')}</GroupLabel>{builtinApiKeyChoices.filter((p) => !q || p.name.toLowerCase().includes(q)).map((p) => (- <ProviderCard+ <ProviderRowkey={p.id}icon={cardIcon({ providerId: p.id, name: p.name })}name={p.name}@@ -1039,7 +1036,7 @@ export function AddProviderWizard({/>))}{filteredPresets.map((p) => (- <ProviderCard+ <ProviderRowkey={p.id}icon={cardIcon({providerId: p.id,@@ -1054,43 +1051,45 @@ export function AddProviderWizard({onClick={() => pickPreset(p)}/>))}- </div>- </>- )}+ </>+ )}+ </div>- <GroupLabel>{t('settings.providers.wizard.groupCustom')}</GroupLabel>- <button- type="button"- onClick={onOpenCustomForm}- className="flex items-center gap-2.5 rounded-xl border border-dashed p-3 text-left transition-colors hover:bg-[var(--surface-hover)]"- style={{ borderColor: 'var(--settings-btn-secondary-border)' }}- >- <span- className="flex h-6 w-6 shrink-0 items-center justify-center rounded-md"- style={{- border: '1px solid var(--settings-integration-avatar-border)',- color: 'var(--settings-section-desc)',- }}+ {/* 自定义端点:钉在滚动区外,目录再长也始终可见。 */}+ <div className="flex flex-col gap-2 px-4 pb-1 pt-3">+ <button+ type="button"+ onClick={onOpenCustomForm}+ className="flex items-center gap-2.5 rounded-xl border border-dashed p-3 text-left transition-colors hover:bg-[var(--surface-hover)]"+ style={{ borderColor: 'var(--settings-btn-secondary-border)' }}>- <Plus size={13} />- </span>- <span className="flex min-w-0 flex-col"><span- className="text-13 font-medium"- style={{ color: 'var(--settings-section-title)' }}+ className="flex h-6 w-6 shrink-0 items-center justify-center rounded-lg"+ style={{+ border: '1px solid var(--settings-integration-avatar-border)',+ color: 'var(--settings-section-desc)',+ }}>- {t('settings.providers.wizard.customTitle')}+ <Plus size={13} /></span>- <span className="truncate text-11" style={{ color: 'var(--text-tertiary)' }}>- {t('settings.providers.wizard.customMeta')}+ <span className="flex min-w-0 flex-col">+ <span+ className="text-13 font-medium"+ style={{ color: 'var(--settings-section-title)' }}+ >+ {t('settings.providers.wizard.customTitle')}+ </span>+ <span className="truncate text-11" style={{ color: 'var(--text-tertiary)' }}>+ {t('settings.providers.wizard.customMeta')}+ </span></span>- </span>- </button>+ </button>- <p className="pt-4 text-11 leading-snug" style={{ color: 'var(--text-tertiary)' }}>- {t('settings.providers.wizard.pickHint')}- </p>- </div>+ <p className="text-11 leading-snug" style={{ color: 'var(--text-tertiary)' }}>+ {t('settings.providers.wizard.pickHint')}+ </p>+ </div>+ </>)}{step === 2 && sel?.kind === 'oauth' && (@@ -1128,7 +1127,7 @@ export function AddProviderWizard({<buttontype="button"onClick={cancelAuthorize}- className="flex h-9 items-center justify-center gap-2 rounded-full border px-5 text-13 font-medium transition-colors hover:bg-[var(--surface-hover)]"+ className="flex h-9 items-center justify-center gap-2 rounded-full border px-6 text-13 font-medium transition-colors hover:bg-[var(--surface-hover)]"style={{backgroundColor: 'var(--settings-btn-secondary-bg)',borderColor: 'var(--settings-btn-secondary-border)',@@ -1143,7 +1142,7 @@ export function AddProviderWizard({<buttontype="button"onClick={() => void handleAuthorize('browser')}- className="flex h-9 items-center justify-center rounded-full border px-5 text-13 font-medium transition-colors hover:bg-[var(--surface-hover)]"+ className="flex h-9 items-center justify-center rounded-full border px-6 text-13 font-medium transition-colors hover:bg-[var(--surface-hover)]"style={{backgroundColor: 'var(--settings-btn-secondary-bg)',borderColor: 'var(--settings-btn-secondary-border)',@@ -1162,7 +1161,7 @@ export function AddProviderWizard({<buttontype="button"onClick={() => void handleAuthorize('device-code')}- className="flex h-9 items-center justify-center rounded-full border px-5 text-13 font-medium transition-colors hover:bg-[var(--surface-hover)]"+ className="flex h-9 items-center justify-center rounded-full border px-6 text-13 font-medium transition-colors hover:bg-[var(--surface-hover)]"style={{backgroundColor: 'transparent',borderColor: 'var(--settings-btn-secondary-border)',@@ -1183,7 +1182,7 @@ export function AddProviderWizard({type="button"onClick={() => pickPreset(OFFICIAL_API_PRESETS[sel.provider.id])}disabled={loggingIn}- className="flex h-9 items-center justify-center rounded-full border px-5 text-13 font-medium transition-colors hover:bg-[var(--surface-hover)] disabled:opacity-50"+ className="flex h-9 items-center justify-center rounded-full border px-6 text-13 font-medium transition-colors hover:bg-[var(--surface-hover)] disabled:opacity-50"style={{backgroundColor: 'transparent',borderColor: 'var(--settings-btn-secondary-border)',@@ -1496,10 +1495,8 @@ export function AddProviderWizard({</div>{/* 底部 */}- <div- className="flex items-center justify-between border-t px-6 py-3.5"- style={{ borderColor: 'var(--border-default)' }}- >+ {/* 底部操作行:不再加分割线 —— 弹窗内只保留滚动区上下两条细线(原型定稿)。 */}+ <div className="flex items-center justify-between px-4 pb-4 pt-2"><buttontype="button"onClick={() => {@@ -1525,7 +1522,7 @@ export function AddProviderWizard({<buttontype="button"onClick={handleClose}- className="flex h-9 items-center justify-center rounded-full border px-5 text-13 font-medium transition-colors hover:bg-[var(--surface-hover)]"+ className="flex h-9 items-center justify-center rounded-full border px-6 text-13 font-medium transition-colors hover:bg-[var(--surface-hover)]"style={{borderColor: 'var(--settings-btn-secondary-border)',color: 'var(--settings-btn-secondary-text)',@@ -1556,7 +1553,7 @@ export function AddProviderWizard({onClick={() => void startFetch()}disabled={!presetCanContinue}className={cn(- 'flex h-9 items-center justify-center rounded-full px-5 text-13 font-medium transition-opacity',+ 'flex h-9 items-center justify-center rounded-full px-6 text-13 font-medium transition-opacity',!presetCanContinue ? 'cursor-not-allowed opacity-50' : 'hover:opacity-90',)}style={{ backgroundColor: 'var(--accent-cta-bg)', color: 'var(--surface-on-card)' }}@@ -1570,7 +1567,7 @@ export function AddProviderWizard({onClick={() => void handleFinish()}disabled={saving || fetchState.status === 'fetching' || checkedCount === 0}className={cn(- 'flex h-9 items-center justify-center gap-2 rounded-full px-5 text-13 font-medium transition-opacity',+ 'flex h-9 items-center justify-center gap-2 rounded-full px-6 text-13 font-medium transition-opacity',saving || fetchState.status === 'fetching' || checkedCount === 0? 'cursor-not-allowed opacity-50': 'hover:opacity-90',diff --git a/apps/desktop/src/renderer/components/settings/ProvidersSection.tsx b/apps/desktop/src/renderer/components/settings/ProvidersSection.tsxindex b28121353b..773651d9dd 100644--- a/apps/desktop/src/renderer/components/settings/ProvidersSection.tsx+++ b/apps/desktop/src/renderer/components/settings/ProvidersSection.tsx@@ -96,7 +96,7 @@ function providerIcon(p: ProviderView, size: number): ReactNode {if (hasProviderLogo(p.id, p.routing)) {return <ProviderLogoMark providerId={p.id} routing={p.routing} size={size} />;}- return <span className="text-15 font-semibold leading-none">{providerMonogram(p.name)}</span>;+ return <span className="text-15 font-medium leading-none">{providerMonogram(p.name)}</span>;}// ---------------------------------------------------------------------------@@ -167,7 +167,7 @@ function PillButton({onClick={onClick}disabled={disabled}className={cn(- 'flex h-8 shrink-0 items-center justify-center rounded-full px-[14px] text-13 font-medium transition-colors',+ 'flex h-8 shrink-0 items-center justify-center rounded-full px-6 text-13 font-medium transition-colors','border',disabled && 'cursor-not-allowed opacity-60',)}@@ -210,7 +210,7 @@ function RowIconButton({type="button"onClick={onClick}aria-label={label}- className="flex h-7 w-7 items-center justify-center rounded-md transition-colors hover:bg-[var(--surface-hover)]"+ className="flex h-7 w-7 items-center justify-center rounded-full transition-colors hover:bg-[var(--surface-hover)]"style={{ color: 'var(--text-tertiary)' }}>{icon}@@ -258,7 +258,9 @@ function DetailHeader({return (<div className={cn('flex flex-col px-5 py-4', detail && 'gap-3')}>- <div className="flex items-center gap-3">+ {/* 可折行:最小窗口(右栏 ~275px)放不下「状态 + 操作」时整组换行,+ 不被卡片 overflow-hidden 裁掉(PR #1102 review 第三轮)。 */}+ <div className="flex flex-wrap items-center gap-3 gap-y-2"><divclassName="flex h-9 w-9 shrink-0 items-center justify-center rounded-lg"style={{@@ -309,7 +311,7 @@ function DetailHeader({<buttontype="button"aria-label={t('settings.providers.detail.moreActionsAria')}- className="flex h-7 w-7 shrink-0 items-center justify-center rounded-md transition-colors hover:bg-[var(--surface-hover)]"+ className="flex h-7 w-7 shrink-0 items-center justify-center rounded-full transition-colors hover:bg-[var(--surface-hover)]"style={{ color: 'var(--text-tertiary)' }}><MoreHorizontal size={15} />@@ -588,7 +590,9 @@ function ImageApiKeyRow({if (configured === null) return null;return (- <div className="flex items-center gap-2 pt-2">+ /* 可折行:最小窗口(右栏 ~250px 内容区)下「标签 + 掩码/输入框 + 按钮」+ 放不下时换行,操作始终可达(PR #1102 review 第八轮;与详情头折行同口径)。 */+ <div className="flex flex-wrap items-center gap-2 gap-y-2 pt-2"><span className="shrink-0 text-12 font-medium" style={{ color: 'var(--text-secondary)' }}>{t('settings.providers.imagesKey.label')}</span>@@ -895,7 +899,9 @@ function BuiltinApiKeyHeader({}, [confirm, onChanged, provider.id, provider.name, t]);const trailing = (- <div className="flex shrink-0 items-center gap-2.5">+ /* 三控件组自身可折行:最小窗口(内容区 ~235px)下「已连接 / 更换 key / 断开」+ 放不下时组内换行,不再作为整体溢出被裁(PR #1102 review 第九轮)。 */+ <div className="flex min-w-0 flex-wrap items-center justify-end gap-2.5 gap-y-2">{provider.connected && <ConnectedPill />}<PillButtonlabel={t(@@ -1090,7 +1096,7 @@ function XdGatewayHeader({connected && syncStatus.state !== 'unsupported' ? (<div className="flex items-center gap-2.5 pl-12"><span- className="flex shrink-0 items-center rounded-md px-2 py-1 text-12"+ className="flex shrink-0 items-center rounded-lg px-2 py-1 text-12"style={{backgroundColor: 'var(--surface-chip)',border: '1px solid var(--settings-integration-avatar-border)',@@ -1262,7 +1268,7 @@ function CindySigninRow({ selected, onSelect }: { selected: boolean; onSelect: (style={selected ? { backgroundColor: 'var(--surface-chip)' } : undefined}><div- className="flex h-7 w-7 shrink-0 items-center justify-center rounded-md"+ className="flex h-7 w-7 shrink-0 items-center justify-center rounded-lg"style={{backgroundColor: 'var(--settings-integration-avatar-bg)',border: '1px solid var(--settings-integration-avatar-border)',@@ -1315,7 +1321,7 @@ function ListRow({style={selected ? { backgroundColor: 'var(--surface-chip)' } : undefined}><div- className="flex h-7 w-7 shrink-0 items-center justify-center rounded-md"+ className="flex h-7 w-7 shrink-0 items-center justify-center rounded-lg"style={{backgroundColor: 'var(--settings-integration-avatar-bg)',border: '1px solid var(--settings-integration-avatar-border)',@@ -1383,7 +1389,7 @@ function SuggestionRow({className="flex w-full items-center gap-2.5 rounded-lg px-2.5 py-2 text-left transition-colors hover:bg-[var(--surface-hover)]"><div- className="flex h-7 w-7 shrink-0 items-center justify-center rounded-md opacity-70"+ className="flex h-7 w-7 shrink-0 items-center justify-center rounded-lg opacity-70"style={{backgroundColor: 'var(--settings-integration-avatar-bg)',border: '1px solid var(--settings-integration-avatar-border)',@@ -1757,8 +1763,8 @@ export function ProvidersSection() {{suggestions.length > 0 && (<><span- className="px-2.5 pb-1 pt-3 text-11 font-semibold uppercase"- style={{ color: 'var(--text-tertiary)', letterSpacing: '0.4px' }}+ className="px-2.5 pb-1 pt-3 text-11 font-medium uppercase"+ style={{ color: 'var(--text-tertiary)', letterSpacing: '0.5px' }}>{t('settings.providers.detect.groupLabel')}</span>@@ -1794,8 +1800,9 @@ export function ProvidersSection() {</div></div>- {/* 右栏详情 */}- <div className="flex min-w-0 flex-1 flex-col overflow-y-auto">+ {/* 右栏详情:详情头/条带固定,仅模型列表(UnifiedModelList 内部)滚动 ——+ 长清单滚动时供应商名称、连接状态与工具行不随之滚走(2026-07 定稿)。 */}+ <div className="flex min-w-0 flex-1 flex-col">{cindySigninActive ? (<div className="flex flex-1 flex-col items-center justify-center gap-3 px-8 text-center"><divdiff --git a/apps/desktop/src/renderer/components/settings/UnifiedModelList.tsx b/apps/desktop/src/renderer/components/settings/UnifiedModelList.tsxindex b484b51c7f..33b06b2a0d 100644--- a/apps/desktop/src/renderer/components/settings/UnifiedModelList.tsx+++ b/apps/desktop/src/renderer/components/settings/UnifiedModelList.tsx@@ -478,7 +478,7 @@ export function UnifiedModelList({type="button"aria-label={t('settings.providers.detail.moreActionsAria')}className={cn(- 'flex h-6 w-6 shrink-0 items-center justify-center rounded-md opacity-0 transition-opacity',+ 'flex h-6 w-6 shrink-0 items-center justify-center rounded-full opacity-0 transition-opacity','hover:bg-[var(--surface-hover)] focus-visible:opacity-100 group-hover:opacity-100 data-[state=open]:opacity-100',)}style={{ color: 'var(--text-tertiary)' }}@@ -501,16 +501,19 @@ export function UnifiedModelList({);return (- <div className="flex flex-col">+ <div className="flex min-h-0 flex-1 flex-col">{/* 工具行:标题(开关语义的唯一说明,**常驻**,不被搜索框挤掉 —— 2026-07-28 用户反馈)+ 搜索 + 刷新(自定义) + 分别调整(双 agent) + 全部开关 */}- <div className="flex items-center gap-3 px-5 py-2.5">+ <div className="flex flex-wrap items-center gap-x-3 gap-y-2 px-5 py-2.5"><span className="shrink-0 text-13 font-medium" style={{ color: 'var(--text-secondary)' }}>{t('settings.providers.models.available')}</span>- {showSearch ? (+ <span className="min-w-0 flex-1" />+ {showSearch && (+ /* basis 200px 但允许收缩:窄窗口(右栏可被压到 ~270px)时先压缩搜索框,+ 不让右侧操作被 overflow-hidden 裁掉(PR #1102 review)。 */<div- className="flex h-8 min-w-0 flex-1 items-center gap-2 rounded-full px-3"+ className="flex h-8 min-w-0 basis-[200px] items-center gap-2 rounded-full px-3"style={{ backgroundColor: 'var(--surface-elevated)', border: '1px solid var(--border-default)' }}><Search size={14} className="shrink-0" style={{ color: 'var(--text-tertiary)' }} />@@ -524,8 +527,6 @@ export function UnifiedModelList({style={{ color: 'var(--settings-section-title)' }}/></div>- ) : (- <span className="min-w-0 flex-1" />)}{onRefresh && (<button@@ -573,8 +574,8 @@ export function UnifiedModelList({{provider.agents.map((a) => (<spankey={a}- className="w-[88px] text-center text-11 font-semibold uppercase"- style={{ color: 'var(--text-tertiary)', letterSpacing: '0.4px' }}+ className="w-20 text-center text-11 font-medium uppercase"+ style={{ color: 'var(--text-tertiary)', letterSpacing: '0.5px' }}>{AGENT_LABEL[a]}</span>@@ -583,256 +584,288 @@ export function UnifiedModelList({</div>)}- {/* 分组 + 模型行 + 底部「已停用」分区 */}- <div className="flex flex-col gap-4 px-5 pb-4 pt-0.5">- {groups.length === 0 && disabledRows.length === 0 ? (- <div className="py-4 text-center text-13" style={{ color: 'var(--text-tertiary)' }}>- {query.trim()- ? t('settings.providers.models.noResults')- : (emptyMessage ?? t('settings.providers.models.noResults'))}- </div>- ) : (- groups.map((g) => {- // 搜索时强制展开(否则匹配项藏在折叠组里看不到);仅多组时才有折叠头。- const collapsed = showGroupHeaders && !query.trim() && isCollapsed(g.category);- // 能力语义按**行**判(isCapabilityRow,含自定义供应商的未知 group 豁免),- // 不能只看分组名:自定义对话模型(如 gpt-4o-audio-preview)会被 groupOf 的- // id 启发式落进 audio 组展示,但它有显示轴、必须有开关(PR #744 review)。- // 组级 hint 只在整组都是能力行时显示。- const userProvider = provider.source === 'user';- const wholeGroupCapability =- CAPABILITY_CATEGORIES.has(g.category) &&- g.rows.length > 0 &&- g.rows.every((r) => isCapabilityRow(r, userProvider));- return (- <div key={g.category} className="flex flex-col">- {showGroupHeaders && (- <button- type="button"- onClick={() => toggleCollapsed(g.category)}- aria-expanded={!collapsed}- className="flex items-center gap-1 self-start pb-0.5 text-left transition-opacity hover:opacity-80"- >- {/* chevron 用 transform 旋转(compositor-only,规则 7);折叠时 -90°。 */}- <span- className="inline-flex transition-transform duration-150"- style={{ color: 'var(--text-tertiary)', transform: collapsed ? 'rotate(-90deg)' : 'none' }}- >- <ChevronDown size={12} />- </span>- <span- className="text-11 font-semibold uppercase"- style={{ color: 'var(--text-tertiary)', letterSpacing: '0.4px' }}- >- {t(CATEGORY_LABEL_KEY[g.category])}- </span>- <span- className="text-11 tabular-nums"- style={{ color: 'var(--text-tertiary)', opacity: 0.6 }}+ {/* 分组 + 模型行 + 底部「已停用」分区:唯一滚动区,与上方固定工具行以+ 1px 细线分隔。视觉左右边距 20px = 容器 px-3 + 行 px-2(行悬停底色要包住内容)。 */}+ <div+ className="min-h-0 flex-1 overflow-y-auto border-t"+ style={{ borderColor: 'var(--settings-theme-card-border)' }}+ >+ <div className="flex flex-col gap-4 px-3 pb-4 pt-1.5">+ {groups.length === 0 && disabledRows.length === 0 ? (+ <div className="py-4 text-center text-13" style={{ color: 'var(--text-tertiary)' }}>+ {query.trim()+ ? t('settings.providers.models.noResults')+ : (emptyMessage ?? t('settings.providers.models.noResults'))}+ </div>+ ) : (+ groups.map((g) => {+ // 搜索时强制展开(否则匹配项藏在折叠组里看不到);仅多组时才有折叠头。+ const collapsed = showGroupHeaders && !query.trim() && isCollapsed(g.category);+ // 能力语义按**行**判(isCapabilityRow,含自定义供应商的未知 group 豁免),+ // 不能只看分组名:自定义对话模型(如 gpt-4o-audio-preview)会被 groupOf 的+ // id 启发式落进 audio 组展示,但它有显示轴、必须有开关(PR #744 review)。+ // 组级 hint 只在整组都是能力行时显示。+ const userProvider = provider.source === 'user';+ const wholeGroupCapability =+ CAPABILITY_CATEGORIES.has(g.category) &&+ g.rows.length > 0 &&+ g.rows.every((r) => isCapabilityRow(r, userProvider));+ return (+ <div key={g.category} className="flex flex-col">+ {showGroupHeaders && (+ <button+ type="button"+ onClick={() => toggleCollapsed(g.category)}+ aria-expanded={!collapsed}+ className="flex items-center gap-1 self-start px-2 pb-0.5 text-left transition-opacity hover:opacity-80">- {g.rows.length}- </span>- </button>- )}- {/* 能力模型组的消歧说明:这组不参与对话模型选择、行内没有显示开关 ——- 语义与上面的对话模型组不同,必须就地讲清,不能指望用户猜。 */}- {wholeGroupCapability && !collapsed && (- <span- className={cn('pb-1 text-11 leading-snug', showGroupHeaders && 'pl-[17px]')}- style={{ color: 'var(--text-tertiary)' }}- >- {t('settings.providers.models.capabilityGroupHint')}- </span>- )}- {!collapsed &&- g.rows.map((row) => {- const rep = row.byAgent[row.avail[0]]!;- const capability = isCapabilityRow(row, userProvider);- const diverged = !capability && isRowDiverged(provider.id, row);- const anyOn = rowAnyEnabled(provider.id, row);- // 能力注记:仅双 agent 供应商 + 单端模型才标(单 agent 供应商头部已说明);- // 能力模型行不标(它们本来就不参与 agent 维度)。- const capNote =- !capability && multiAgent && row.avail.length === 1- ? t('settings.providers.models.capabilityNote', {- agent: AGENT_LABEL[row.avail[0] === 'claude-code' ? 'codex' : 'claude-code'],- })- : null;- // 上下文窗口取代表值;双端不同用原生 title 提示。- const ctxValues = row.avail- .map((a) => row.byAgent[a]?.contextWindow)- .filter((v): v is number => typeof v === 'number');- const ctxDiffers = new Set(ctxValues).size > 1;- const ctxTitle = ctxDiffers- ? row.avail- .map((a) => `${AGENT_LABEL[a]} ${formatContextWindow(row.byAgent[a]!.contextWindow)}`)- .join(' · ')- : undefined;- const hiddenAgent = diverged- ? row.avail.find((a) => rowEnabled(provider.id, row, a) === false)- : undefined;- return (- <div key={row.id} className="group flex items-center gap-3 py-[7px]">+ {/* chevron 用 transform 旋转(compositor-only,规则 7);折叠时 -90°。 */}<span- className="min-w-0 truncate text-14 font-medium"- style={{- color:- capability || anyOn- ? 'var(--settings-section-title)'- : 'var(--text-tertiary)',- }}+ className="inline-flex transition-transform duration-150"+ style={{ color: 'var(--text-tertiary)', transform: collapsed ? 'rotate(-90deg)' : 'none' }}>- {rep.name}+ <ChevronDown size={12} /></span>- {capNote && (- <span className="shrink-0 text-12" style={{ color: 'var(--text-tertiary)' }}>- {capNote}- </span>- )}- <span className="min-w-0 flex-1" />- {!splitMode && diverged && hiddenAgent && (- <button- type="button"- onClick={() => setSplitMode(true)}- className="flex h-[18px] shrink-0 items-center rounded-full px-2 text-11 font-medium transition-opacity hover:opacity-80"- style={{- backgroundColor: 'var(--surface-chip)',- color: 'var(--text-secondary)',- }}- >- {t('settings.providers.models.divergedChip', { agent: AGENT_LABEL[hiddenAgent] })}- </button>- )}- {/* 合成媒体行(专属清单下发)没有上下文窗口元数据(=0),不显示。 */}- {rep.contextWindow > 0 && (- <span- className="shrink-0 text-12 tabular-nums"- style={{ color: 'var(--text-tertiary)' }}- title={ctxTitle}- >- {formatContextWindow(rep.contextWindow)}- </span>- )}- {rowMenu(row)}- {/* 能力模型行没有显示轴 ⇒ 没有开关(全页开关语义唯一 = 显示)。 */}- {!capability &&- (splitMode ? (- <div className="flex shrink-0 items-center">- {provider.agents.map((a) => {- const m = row.byAgent[a];- return (- <span key={a} className="flex w-[88px] items-center justify-center">- {m ? (- <Switch- checked={isModelEnabled(a, provider.id, m)}- onCheckedChange={(v) => setModelVisibility(a, provider.id, m.id, v)}- aria-label={`${rep.name} · ${AGENT_LABEL[a]}`}- />- ) : (- <span className="text-12" style={{ color: 'var(--text-tertiary)' }}>- —- </span>- )}- </span>- );- })}- </div>- ) : (- <Switch checked={anyOn} onCheckedChange={() => toggleRow(row)} aria-label={rep.name} />- ))}- </div>- );- })}- </div>- );- })- )}-- {/* 「已停用」分区:停用的行跨分组沉底;默认展开(区里有东西 = 用户主动停的,- 找回路径要一眼可见),搜索时强制展开。行内「启用此模型」即飞回原分组;- 头部「全部启用」= 组级恢复默认(kind:'reset' 删整组 override,含指向已- 下架模型的陈旧条目 —— 逐行启用清不掉它们;configuration-and-overrides.md §4)。- 渲染条件独立于当前渲染行:只剩陈旧条目(disabledRows 为空)或搜索过滤后- 无匹配行时,恢复入口都不能消失(PR #744 review 第二十六轮)。 */}- {(disabledRows.length > 0 || (provider.disableOverrideCount ?? 0) > 0) && (() => {- const collapsed = !query.trim() && isCollapsed(DISABLED_GROUP_KEY);- return (- <div className="flex flex-col">- <div className="flex items-center gap-2 pb-0.5">- <button- type="button"- onClick={() => toggleCollapsed(DISABLED_GROUP_KEY)}- aria-expanded={!collapsed}- className="flex items-center gap-1 text-left transition-opacity hover:opacity-80"- >- <span- className="inline-flex transition-transform duration-150"- style={{ color: 'var(--text-tertiary)', transform: collapsed ? 'rotate(-90deg)' : 'none' }}- >- <ChevronDown size={12} />- </span>+ <span+ className="text-11 font-medium uppercase"+ style={{ color: 'var(--text-tertiary)', letterSpacing: '0.5px' }}+ >+ {t(CATEGORY_LABEL_KEY[g.category])}+ </span>+ <span+ className="text-11 tabular-nums"+ style={{ color: 'var(--text-tertiary)', opacity: 0.6 }}+ >+ {g.rows.length}+ </span>+ </button>+ )}+ {/* 能力模型组的消歧说明:这组不参与对话模型选择、行内没有显示开关 ——+ 语义与上面的对话模型组不同,必须就地讲清,不能指望用户猜。 */}+ {wholeGroupCapability && !collapsed && (<span- className="text-11 font-semibold uppercase"- style={{ color: 'var(--text-tertiary)', letterSpacing: '0.4px' }}+ className={cn('pb-1 text-11 leading-snug', showGroupHeaders && 'pl-[24px]')}+ style={{ color: 'var(--text-tertiary)' }}>- {t('settings.providers.models.disabledGroup')}+ {t('settings.providers.models.capabilityGroupHint')}</span>- <span className="text-11 tabular-nums" style={{ color: 'var(--text-tertiary)', opacity: 0.6 }}>- {/* 行数为 0 而 override 仍在(陈旧条目 / 搜索过滤)时显示 override 数,- 让「还有 N 条停用配置」可感知。 */}- {disabledRows.length > 0 ? disabledRows.length : provider.disableOverrideCount ?? 0}- </span>- </button>- <button- type="button"- onClick={resetDisableOverrides}- className="rounded-md px-1.5 py-0.5 text-11 font-medium transition-colors hover:bg-[var(--surface-hover)]"- style={{ color: 'var(--text-tertiary)' }}- >- {t('settings.providers.models.enableAllModels')}- </button>- </div>- {!collapsed &&- disabledRows.map((row) => {+ )}+ {!collapsed &&+ g.rows.map((row) => {const rep = row.byAgent[row.avail[0]]!;+ const capability = isCapabilityRow(row, userProvider);+ const diverged = !capability && isRowDiverged(provider.id, row);+ const anyOn = rowAnyEnabled(provider.id, row);+ // 能力注记:仅双 agent 供应商 + 单端模型才标(单 agent 供应商头部已说明);+ // 能力模型行不标(它们本来就不参与 agent 维度)。+ const capNote =+ !capability && multiAgent && row.avail.length === 1+ ? t('settings.providers.models.capabilityNote', {+ agent: AGENT_LABEL[row.avail[0] === 'claude-code' ? 'codex' : 'claude-code'],+ })+ : null;+ // 上下文窗口取代表值;双端不同用原生 title 提示。+ const ctxValues = row.avail+ .map((a) => row.byAgent[a]?.contextWindow)+ .filter((v): v is number => typeof v === 'number');+ const ctxDiffers = new Set(ctxValues).size > 1;+ const ctxTitle = ctxDiffers+ ? row.avail+ .map((a) => `${AGENT_LABEL[a]} ${formatContextWindow(row.byAgent[a]!.contextWindow)}`)+ .join(' · ')+ : undefined;+ const hiddenAgent = diverged+ ? row.avail.find((a) => rowEnabled(provider.id, row, a) === false)+ : undefined;return (- <div key={row.id} className="flex items-center gap-3 py-[7px]">+ <div+ key={row.id}+ className="group flex items-center gap-3 rounded-lg px-2 py-[7px] transition-colors hover:bg-[var(--surface-hover)]"+ ><spanclassName="min-w-0 truncate text-14 font-medium"- style={{ color: 'var(--text-disabled)' }}+ style={{+ color:+ capability || anyOn+ ? 'var(--settings-section-title)'+ : 'var(--text-tertiary)',+ }}>{rep.name}</span>- {/* 来源分组注记:启用后会回到哪个组,别让用户猜。 */}- <span className="shrink-0 text-12" style={{ color: 'var(--text-tertiary)' }}>- {t(CATEGORY_LABEL_KEY[rowCategory(row)])}- </span>+ {capNote && (+ /* 注记可收缩截断:窄栏(最小窗口右栏 ~275px)下先压缩次要+ 元数据,保住右侧上下文/菜单/开关列(PR #1102 review 第五轮);+ 截断时悬停可见全文。 */+ <span+ className="min-w-0 truncate text-12"+ style={{ color: 'var(--text-tertiary)' }}+ title={capNote}+ >+ {capNote}+ </span>+ )}<span className="min-w-0 flex-1" />- {rep.contextWindow > 0 && (+ {!splitMode && diverged && hiddenAgent && (+ <button+ type="button"+ onClick={() => setSplitMode(true)}+ className="flex h-[18px] shrink-0 items-center rounded-full px-2 text-11 font-medium transition-opacity hover:opacity-80"+ style={{+ backgroundColor: 'var(--surface-chip)',+ color: 'var(--text-secondary)',+ }}+ >+ {t('settings.providers.models.divergedChip', { agent: AGENT_LABEL[hiddenAgent] })}+ </button>+ )}+ {/* 固定 44px 右对齐列:上下扫读时数字齐成一条线;合成媒体行+ (专属清单下发)没有上下文窗口元数据(=0),留空占位保持列对齐。 */}+ {/* 分别调整模式隐藏上下文列:两列开关 + 菜单在最小窗口+ (右栏 ~275px)下必须完整可见,上下文是次要元数据,+ 普通模式仍展示(PR #1102 review 第二轮)。 */}+ {!splitMode && (<span- className="shrink-0 text-12 tabular-nums"- style={{ color: 'var(--text-disabled)' }}+ className="w-11 shrink-0 text-right text-12 tabular-nums"+ style={{ color: 'var(--text-tertiary)' }}+ title={ctxTitle}>- {formatContextWindow(rep.contextWindow)}+ {rep.contextWindow > 0 ? formatContextWindow(rep.contextWindow) : ''}</span>)}- <button- type="button"- onClick={() => setRowDisabled(row, false)}- className="flex h-6 shrink-0 items-center rounded-full border px-2.5 text-12 font-medium transition-colors hover:bg-[var(--surface-hover)]"- style={{- borderColor: 'var(--settings-btn-secondary-border)',- color: 'var(--settings-btn-secondary-text)',- }}- >- {t('settings.providers.models.enableModel')}- </button>+ {rowMenu(row)}+ {/* 能力模型行没有显示轴 ⇒ 没有开关(全页开关语义唯一 = 显示);+ 占同宽空位,保证开关/上下文列跨行对齐。 */}+ {capability && (+ <span+ className="shrink-0"+ style={{ width: splitMode ? provider.agents.length * 80 : 36 }}+ />+ )}+ {!capability &&+ (splitMode ? (+ <div className="flex shrink-0 items-center">+ {provider.agents.map((a) => {+ const m = row.byAgent[a];+ return (+ <span key={a} className="flex w-20 items-center justify-center">+ {m ? (+ <Switch+ checked={isModelEnabled(a, provider.id, m)}+ onCheckedChange={(v) => setModelVisibility(a, provider.id, m.id, v)}+ aria-label={`${rep.name} · ${AGENT_LABEL[a]}`}+ />+ ) : (+ <span className="text-12" style={{ color: 'var(--text-tertiary)' }}>+ —+ </span>+ )}+ </span>+ );+ })}+ </div>+ ) : (+ <Switch checked={anyOn} onCheckedChange={() => toggleRow(row)} aria-label={rep.name} />+ ))}</div>);})}- </div>- );- })()}+ </div>+ );+ })+ )}++ {/* 「已停用」分区:停用的行跨分组沉底;默认展开(区里有东西 = 用户主动停的,+ 找回路径要一眼可见),搜索时强制展开。行内「启用此模型」即飞回原分组;+ 头部「全部启用」= 组级恢复默认(kind:'reset' 删整组 override,含指向已+ 下架模型的陈旧条目 —— 逐行启用清不掉它们;configuration-and-overrides.md §4)。+ 渲染条件独立于当前渲染行:只剩陈旧条目(disabledRows 为空)或搜索过滤后+ 无匹配行时,恢复入口都不能消失(PR #744 review 第二十六轮)。 */}+ {(disabledRows.length > 0 || (provider.disableOverrideCount ?? 0) > 0) && (() => {+ const collapsed = !query.trim() && isCollapsed(DISABLED_GROUP_KEY);+ return (+ <div className="flex flex-col">+ <div className="flex items-center gap-2 pb-0.5">+ <button+ type="button"+ onClick={() => toggleCollapsed(DISABLED_GROUP_KEY)}+ aria-expanded={!collapsed}+ className="flex items-center gap-1 px-2 text-left transition-opacity hover:opacity-80"+ >+ <span+ className="inline-flex transition-transform duration-150"+ style={{ color: 'var(--text-tertiary)', transform: collapsed ? 'rotate(-90deg)' : 'none' }}+ >+ <ChevronDown size={12} />+ </span>+ <span+ className="text-11 font-medium uppercase"+ style={{ color: 'var(--text-tertiary)', letterSpacing: '0.5px' }}+ >+ {t('settings.providers.models.disabledGroup')}+ </span>+ <span className="text-11 tabular-nums" style={{ color: 'var(--text-tertiary)', opacity: 0.6 }}>+ {/* 行数为 0 而 override 仍在(陈旧条目 / 搜索过滤)时显示 override 数,+ 让「还有 N 条停用配置」可感知。 */}+ {disabledRows.length > 0 ? disabledRows.length : provider.disableOverrideCount ?? 0}+ </span>+ </button>+ <button+ type="button"+ onClick={resetDisableOverrides}+ className="rounded-lg px-1.5 py-0.5 text-11 font-medium transition-colors hover:bg-[var(--surface-hover)]"+ style={{ color: 'var(--text-tertiary)' }}+ >+ {t('settings.providers.models.enableAllModels')}+ </button>+ </div>+ {!collapsed &&+ disabledRows.map((row) => {+ const rep = row.byAgent[row.avail[0]]!;+ // 可折行:最小窗口(右栏 ~275px)下「启用此模型」(日文更长)放+ // 不下时换行,恢复入口始终可达(PR #1102 review 第四轮)。+ return (+ <div+ key={row.id}+ className="flex flex-wrap items-center gap-x-3 gap-y-1 px-2 py-[7px]"+ >+ <span+ className="min-w-0 truncate text-14 font-medium"+ style={{ color: 'var(--text-disabled)' }}+ >+ {rep.name}+ </span>+ {/* 来源分组注记:启用后会回到哪个组,别让用户猜。 */}+ <span className="shrink-0 text-12" style={{ color: 'var(--text-tertiary)' }}>+ {t(CATEGORY_LABEL_KEY[rowCategory(row)])}+ </span>+ <span className="min-w-0 flex-1" />+ {rep.contextWindow > 0 && (+ <span+ className="w-11 shrink-0 text-right text-12 tabular-nums"+ style={{ color: 'var(--text-disabled)' }}+ >+ {formatContextWindow(rep.contextWindow)}+ </span>+ )}+ <button+ type="button"+ onClick={() => setRowDisabled(row, false)}+ className="ml-auto flex h-6 shrink-0 items-center rounded-full border px-2.5 text-12 font-medium transition-colors hover:bg-[var(--surface-hover)]"+ style={{+ borderColor: 'var(--settings-btn-secondary-border)',+ color: 'var(--settings-btn-secondary-text)',+ }}+ >+ {t('settings.providers.models.enableModel')}+ </button>+ </div>+ );+ })}+ </div>+ );+ })()}+ </div></div>{priceRow && (<ModelPriceOverrideDialogdiff --git a/docs/design-rules/DESIGN.md b/docs/design-rules/DESIGN.mdindex 0376d5f7cd..5f5fd14091 100644--- a/docs/design-rules/DESIGN.md+++ b/docs/design-rules/DESIGN.md@@ -201,6 +201,8 @@ Reference implementation: `apps/desktop/src/renderer/components/ui/confirm-dialo- **Title / description**: `--confirm-title` / `--confirm-desc`, medium weight.- **Buttons**: pill (9999px); primary = solid CTA (`--confirm-btn-primary-*`), secondary/cancel = outlined (`--confirm-btn-secondary-*`, transparent fill + Board border); footer `justify-end`.- **Focus on open**: lands on the dialog's **primary input or primary button**, never defaults to Cancel (see §14.2 + ConfirmDialog's `autoFocusConfirm` / `onOpenAutoFocus`).+- **Closing affordance** (made explicit 2026-07-30, scope clarified 2026-07-31): **dismissible** dialogs (wizards, catalogs, forms — anything a user may abandon freely) close via the footer Cancel button, Esc, and a scrim click, and carry **no top-right × close icon** — a × coexisting with Cancel is a spec violation, not a convenience. Confirm-tier dialogs built on AlertDialog (ConfirmDialog) intentionally do **not** close on scrim click (a deliberate mis-tap guard) — that behavior stays. Known legacy debt: CustomProviderDialog still ships a top-right × predating this rule — migrate it the next time that dialog is touched; do not copy the pattern into new dialogs.+- **Multi-step dialogs / wizards** (registered 2026-07-30, first consumer: Add-Provider wizard): the step indicator lives in the header row (round numbered chips — current step solid `--accent-cta-bg` with `--surface-on-card` text, completed steps ✓ on `--surface-chip`, upcoming outlined `--border-default`). Footer: **back navigation ("← 上一步") is a left-aligned text button** (`--text-secondary`, 13px/500) — navigation is not a commit action and must not sit inside the right-aligned pill group; commit actions (取消 / 下一步 / 完成) remain right-aligned pills per the button rule above. Catalog/list steps put the scrollable region between **two full-width 1px `--border-default` hairlines**, with permanent entries (e.g. 自定义端点) pinned below the scroll region, always visible. Width matches the custom-provider form dialog (600px, `min(600px, 100vw-32px)`) so the two provider dialogs read as one family; height is capped at `min(640px, 85vh)` — on large displays a catalog dialog must not stretch toward full-screen height (2026-07-30 ruling).### Tabs