From e756105d0fd4652c2e21c1a8fb428714f5061911 Mon Sep 17 00:00:00 2001 From: jackwener Date: Fri, 7 Aug 2026 17:38:37 +0800 Subject: [PATCH 1/2] fix(settings): let the models page set the default connection MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Closes #158. Changing the default connection was possible only from the command palette. The models page displayed a 默认 Badge on whichever connection held it and offered no way to change it — so a user who went looking where the answer is shown found a read-only label. One of them said so: "这默认模型连接改不了吗, 在模型里找半天." They were looking in exactly the right place. The badge slot in the connection detail header now carries both halves of the same fact: the default connection shows the Badge, and any other connection shows a 设为默认 button in its place. Whichever a connection is, that slot tells you — and is how you change it. `clickAction` rather than onClick: this opens no confirmation, so there is no state-driven UI to await inside the transition, and the pending affordance comes with it. On failure the toast reports and the state does not move, which leaves the button where it was to retry. The command palette entry stays. It was never wrong, only invisible. --- .../locales/settings-provider-copy.ts | 4 +-- .../src/renderer/settings/ProvidersPanel.tsx | 33 ++++++++++++++++++- 2 files changed, 34 insertions(+), 3 deletions(-) diff --git a/apps/desktop/src/renderer/locales/settings-provider-copy.ts b/apps/desktop/src/renderer/locales/settings-provider-copy.ts index e5e6ff39e3..1aa4b06e6b 100644 --- a/apps/desktop/src/renderer/locales/settings-provider-copy.ts +++ b/apps/desktop/src/renderer/locales/settings-provider-copy.ts @@ -79,7 +79,7 @@ const zhCopy = { tabs: { recommended: '推荐', accounts: '账号', plans: '模型计划', api: 'API', aggregators: '聚合服务', local: '本地' }, loadFailed: '载入模型连接失败', loadingAria: '正在加载模型供应商', connections: '模型连接', retry: '点击重试。', empty: '还没有模型连接', - emptyHelp: '从下方选择一种连接方式开始。', default: '默认', addHelp: '选择账号登录、模型计划、API、聚合服务或本地运行时。', + emptyHelp: '从下方选择一种连接方式开始。', default: '默认', setDefault: '设为默认', setDefaultTitle: '让新对话默认使用这个连接', setDefaultPending: '设置中…', setDefaultFailed: '设为默认失败', addHelp: '选择账号登录、模型计划、API、聚合服务或本地运行时。', categoriesAria: '模型供应商分类', searchPlaceholder: '搜索服务商', searchAria: '搜索模型服务商', noMatch: '没有匹配的服务商', createSubtitle: '完成必要配置后,连接会出现在模型页上方。', connection: '模型连接', count: (value: number) => `· ${value}`, connectTitle: (name: string) => `连接 ${name}`, @@ -220,7 +220,7 @@ const enCopy: ProviderSettingsCopy = { tabs: { recommended: 'Recommended', accounts: 'Accounts', plans: 'Model plans', api: 'API', aggregators: 'Aggregators', local: 'Local' }, loadFailed: 'Failed to load model connections', loadingAria: 'Loading model providers', connections: 'Connections', retry: 'Select to retry.', empty: 'No model connections yet', - emptyHelp: 'Choose a connection method below to begin.', default: 'Default', addHelp: 'Choose account sign-in, a model plan, API, aggregator, or local runtime.', + emptyHelp: 'Choose a connection method below to begin.', default: 'Default', setDefault: 'Set as default', setDefaultTitle: 'New chats will use this connection', setDefaultPending: 'Setting…', setDefaultFailed: 'Could not set as default', addHelp: 'Choose account sign-in, a model plan, API, aggregator, or local runtime.', categoriesAria: 'Model provider categories', searchPlaceholder: 'Search providers', searchAria: 'Search model providers', noMatch: 'No matching providers', createSubtitle: 'After required setup, the connection appears above on the Models page.', connection: 'Model connection', count: (value: number) => `· ${value}`, connectTitle: (name: string) => `Connect ${name}`, diff --git a/apps/desktop/src/renderer/settings/ProvidersPanel.tsx b/apps/desktop/src/renderer/settings/ProvidersPanel.tsx index 7364ca5e14..eabd65531c 100644 --- a/apps/desktop/src/renderer/settings/ProvidersPanel.tsx +++ b/apps/desktop/src/renderer/settings/ProvidersPanel.tsx @@ -19,6 +19,7 @@ import { type ProviderType, } from '@maka/core'; import { useMountedRef, useUiLocale, useToast , dotForStatus } from '@maka/ui'; +import { settingsActionErrorMessage } from './settings-error-copy'; import { connectionChipStatus } from './provider-connection-status'; import { CATALOG_INITIAL_FILTER, @@ -249,7 +250,37 @@ export function ProvidersPanel({ bridge, initialPage = 'connections', initialCon logo={} titleId={detailTitleId} title={selected.name} - badge={selected.slug === defaultSlug ? : null} + /* The control sits in the slot that shows the state. Setting the + default connection was reachable only from the command palette, + while this page displayed a 默认 Badge and offered no way to + change it — so a user who came here to change it (the obvious + place, since it is where the answer is shown) found a read-only + label and gave up. Whichever of the two a connection is, this + slot now tells the truth AND is the way to change it. + + `clickAction` rather than onClick: it opens no confirm, so there + is no state-driven UI to await inside the transition, and the + button gets its own pending affordance for free. */ + badge={selected.slug === defaultSlug + ? + : ( +