Skip to content

armgit / cindy

Public Imported from GitHub
0

Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。

fix(provider-group): 供应商组并进「允许被远程调用」一行,进页不再闪状态,展开配额不再挤窄页面

Lizidf71cc9b44d5
diff --git a/apps/desktop/src/renderer/__tests__/providersSectionAssetModule.test.tsx b/apps/desktop/src/renderer/__tests__/providersSectionAssetModule.test.tsx
index 98957dca62..5c254ea5dc 100644
--- a/apps/desktop/src/renderer/__tests__/providersSectionAssetModule.test.tsx
+++ b/apps/desktop/src/renderer/__tests__/providersSectionAssetModule.test.tsx
@@ -48,8 +48,6 @@ const {
},
}));
-// 供应商组一行有自己的测试(features/provider-group);这里只验证详情页其余部分。
-vi.mock('@/features/provider-group/ProviderGroupRow', () => ({ ProviderGroupRow: () => null }));
vi.mock('react-i18next', () => ({
useTranslation: () => ({
t: (key: string) => key,
diff --git a/apps/desktop/src/renderer/__tests__/providersSectionDeepLink.test.tsx b/apps/desktop/src/renderer/__tests__/providersSectionDeepLink.test.tsx
index 16b3bbcc06..2cb7c929b9 100644
--- a/apps/desktop/src/renderer/__tests__/providersSectionDeepLink.test.tsx
+++ b/apps/desktop/src/renderer/__tests__/providersSectionDeepLink.test.tsx
@@ -42,8 +42,6 @@ const {
customDialogSpy: vi.fn(),
}));
-// 供应商组一行有自己的测试(features/provider-group);这里只验证详情页其余部分。
-vi.mock('@/features/provider-group/ProviderGroupRow', () => ({ ProviderGroupRow: () => null }));
vi.mock('react-i18next', () => ({
useTranslation: () => ({ t: (key: string) => key, i18n: { language: 'zh-CN' } }),
}));
@@ -134,6 +132,7 @@ import { updateCustomProvider } from '@/lib/customProviders';
import { ProvidersSection } from '@/components/settings/ProvidersSection';
import { useProviderSubscriptionCard } from '@/components/settings/useProviderSubscriptionCard';
+import { __testing as localProviderGroupsTesting } from '@/features/provider-group/useLocalProviderGroups';
vi.mock('@/components/settings/useProviderSubscriptionCard', () => ({
useProviderSubscriptionCard: vi.fn(() => null),
@@ -1012,3 +1011,60 @@ describe('ProvidersSection — 深链定位', () => {
});
});
});
+
+describe('ProvidersSection — 允许被远程调用与供应商组', () => {
+ afterEach(() => localProviderGroupsTesting.reset());
+
+ it('folds the provider group into the remote-use row and waits for the group settings before showing it', async () => {
+ localProviderGroupsTesting.reset();
+ let answer!: (groups: Record<string, unknown>) => void;
+ const list = new Promise<Record<string, unknown>>((resolve) => {
+ answer = resolve;
+ });
+ const command = vi.fn((cmd: { action: string }) =>
+ cmd.action === 'list' ? list : Promise.reject(new Error(`unexpected ${cmd.action}`)),
+ );
+ Object.assign(window.electronAPI, {
+ deviceLink: {
+ getState: vi.fn(async () => ({ remoteControlEnabled: true })),
+ listDevices: vi.fn(async () => ({ devices: [] })),
+ onPresenceChanged: () => () => undefined,
+ onControlTargetChanged: () => () => undefined,
+ },
+ providerGroup: { command, onChanged: () => () => undefined },
+ });
+ providersState.providers = [
+ makeProvider('anthropic', { name: 'Anthropic', connected: true, remoteInvocationEnabled: true }),
+ ];
+ renderAt('?tab=providers&connect=anthropic');
+ await waitFor(() => expect(command).toHaveBeenCalledWith({ action: 'list' }));
+ await waitFor(() => expect(window.electronAPI.deviceLink.getState).toHaveBeenCalled());
+ // 等「允许远程控制」读完,只剩组设置没读到。
+ await act(async () => {
+ await new Promise((resolve) => setTimeout(resolve, 0));
+ });
+ // 组设置还没读到:整行先不出现,不先显示「远程与分享」再跳成组。
+ expect(screen.queryByTestId('provider-remote-access')).toBeNull();
+
+ await act(async () => {
+ answer({
+ anthropic: {
+ strategy: 'least',
+ autoSwitch: true,
+ members: [
+ { key: 'local', kind: 'local', agentDeviceId: null, providerId: 'anthropic', limit: 4, weight: 1, paused: false },
+ { key: 'device:mini:anthropic', kind: 'device', agentDeviceId: 'mini', providerId: 'anthropic', limit: 4, weight: 1, paused: false },
+ ],
+ },
+ });
+ await list;
+ });
+ const row = await screen.findByTestId('provider-remote-access');
+ // 组的状态写在入口按钮上,不再单独占一行;有组时说明 Agent 由组选电脑运行。
+ expect(within(row).getByTestId('provider-share-entry').textContent).toBe('settings.providers.remote.groupBadge');
+ expect(within(row).getByText('settings.providers.detail.remoteAccess.descriptionGroup')).toBeTruthy();
+ expect(within(row).getByRole('switch', { name: 'settings.providers.detail.remoteAccess.ariaLabel' })).toBeTruthy();
+ expect(screen.queryByTestId('provider-group-row')).toBeNull();
+ expect(command).not.toHaveBeenCalledWith(expect.objectContaining({ action: 'get' }));
+ });
+});
diff --git a/apps/desktop/src/renderer/__tests__/providersSectionUnavailableModels.test.tsx b/apps/desktop/src/renderer/__tests__/providersSectionUnavailableModels.test.tsx
index b4b3b79a44..460507a07f 100644
--- a/apps/desktop/src/renderer/__tests__/providersSectionUnavailableModels.test.tsx
+++ b/apps/desktop/src/renderer/__tests__/providersSectionUnavailableModels.test.tsx
@@ -43,8 +43,6 @@ const {
wizardSpy: vi.fn(),
}));
-// 供应商组一行有自己的测试(features/provider-group);这里只验证详情页其余部分。
-vi.mock('@/features/provider-group/ProviderGroupRow', () => ({ ProviderGroupRow: () => null }));
vi.mock('react-i18next', () => ({
useTranslation: () => ({
t: (key: string, options?: { count?: number }) =>
diff --git a/apps/desktop/src/renderer/components/settings/ProvidersSection.tsx b/apps/desktop/src/renderer/components/settings/ProvidersSection.tsx
index 82ee7d941b..695c44dfcb 100644
--- a/apps/desktop/src/renderer/components/settings/ProvidersSection.tsx
+++ b/apps/desktop/src/renderer/components/settings/ProvidersSection.tsx
@@ -110,7 +110,7 @@ import { XDIncMark } from '@/components/icons/XDIncMark';
import { hasProviderLogo, ProviderLogoMark } from '@/components/icons/ProviderLogoMark';
import { SortableList } from '@/components/sidebar/SortableList';
import { ProviderShareEntryButton } from '@/features/provider-share/ProviderShareEntryButton';
-import { ProviderGroupRow } from '@/features/provider-group/ProviderGroupRow';
+import { useLocalProviderGroupsState } from '@/features/provider-group/useLocalProviderGroups';
import { ProviderShareManagePage } from '@/features/provider-share/ProviderShareManagePage';
import { ProviderSharePasteButton } from '@/features/provider-share/ProviderSharePasteDialog';
import {
@@ -162,10 +162,13 @@ function writeProviderDisabled(providerId: string, disabled: boolean, errorText:
}
/**
- * 「允许被远程调用」(供应商级远程 Agent 授权)。默认关闭。能力逐级开启(产品规则
+ * 「允许被远程调用」(供应商级远程 Agent 授权)与「远程与分享」入口合成的一行。默认关闭。能力逐级开启(产品规则
* docs/product-rules/provider-sharing.md §3):允许远程控制 → 允许被远程调用 → 分享。
- * 前两级任一未开启时整行仍显示,但开关或分享入口不可点击,并说明先开启哪一级。
+ * 前两级任一未开启时整行仍显示,但开关不可用,并说明先开启哪一级。
* 成功后 main 广播 PROVIDER_CHANGED 刷新快照。
+ *
+ * 供应商组不另占一行(2026-10-11 用户反馈详情太长):组的状态写在开关左侧的入口按钮上,组设置在入口进去的
+ * 「远程与分享」页。组状态取本机组设置快照,第一次读完之前整行不出现,免得先显示「没有组」再跳成组。
*/
function RemoteProviderAccessRow({
provider,
@@ -180,20 +183,23 @@ function RemoteProviderAccessRow({
}) {
const { t } = useTranslation();
const navigate = useNavigate();
+ const localGroups = useLocalProviderGroupsState();
const [enabled, setEnabled] = useState(provider.remoteInvocationEnabled === true);
const [busy, setBusy] = useState(false);
useEffect(() => {
setEnabled(provider.remoteInvocationEnabled === true);
}, [provider.remoteInvocationEnabled]);
+ if (!localGroups.ready) return null;
+ const group = localGroups.groups[provider.id] ?? null;
const gate = providerShareGate({ remoteControlEnabled, invocationEnabled: enabled });
return (
<div
data-testid="provider-remote-access"
data-share-gate={gate}
- className="flex shrink-0 items-start justify-between gap-3 border-t px-5 py-3"
+ className="flex shrink-0 flex-wrap items-center gap-x-3 gap-y-2 border-t px-5 py-3"
style={{ borderColor: 'var(--settings-theme-card-border)' }}
>
- <div className="flex min-w-0 flex-col gap-1">
+ <div className="flex min-w-[min(100%,240px)] flex-1 flex-col gap-1">
<span className="text-13 font-medium text-[var(--text-primary)]">
{t('settings.providers.detail.remoteAccess.label')}
</span>
@@ -211,13 +217,20 @@ function RemoteProviderAccessRow({
</>
) : gate === 'invocation-off' ? (
t('providerShare.entry.descriptionOff')
+ ) : group ? (
+ // 有组时 Agent 由组选一台运行,不再是「在这台电脑上运行」。
+ t('settings.providers.detail.remoteAccess.descriptionGroup')
) : (
t('settings.providers.detail.remoteAccess.description')
)}
</span>
</div>
- <div className="flex shrink-0 items-center gap-2">
- <ProviderShareEntryButton gate={gate} pendingCount={pendingShareRequests} onOpen={onManageShare} />
+ <div className="ml-auto flex shrink-0 items-center gap-3">
+ <ProviderShareEntryButton
+ groupSize={group ? group.members.length : null}
+ pendingCount={pendingShareRequests}
+ onOpen={onManageShare}
+ />
<Switch
checked={enabled}
disabled={busy || !remoteControlEnabled}
@@ -3294,8 +3307,9 @@ export function ProvidersSection() {
/>
</div>
)}
- {/* 允许被远程调用 + 管理分享:供应商已连接且能跑 Agent 时出现。本机未允许
- 远程控制时整行仍显示,但开关与分享入口不可用(provider-sharing.md §3)。 */}
+ {/* 允许被远程调用 + 「远程与分享」入口(含供应商组):供应商已连接且能跑 Agent 时出现。
+ 本机未允许远程控制时整行仍显示,但开关不可用(provider-sharing.md §3);入口始终可用,
+ 只给本机用时也可以建组(provider-groups.md §10)。 */}
{remoteControlEnabled !== null &&
!effectiveSelected.suspended &&
effectiveSelected.connected &&
@@ -3309,16 +3323,6 @@ export function ProvidersSection() {
onManageShare={() => setShareManageProviderId(effectiveSelected.id)}
/>
)}
- {/* 供应商组:不依赖「允许被远程调用」,只给本机用时也可以建组(provider-groups.md §10)。 */}
- {!effectiveSelected.suspended &&
- effectiveSelected.connected &&
- effectiveSelected.agents.length > 0 && (
- <ProviderGroupRow
- key={`provider-group-${effectiveSelected.id}`}
- providerId={effectiveSelected.id}
- onOpen={() => setShareManageProviderId(effectiveSelected.id)}
- />
- )}
{!effectiveSelected.suspended &&
(providerHasModels(effectiveSelected) ||
isCustomRoutedProvider(effectiveSelected) ||
diff --git a/apps/desktop/src/renderer/features/provider-group/ProviderGroupRow.tsx b/apps/desktop/src/renderer/features/provider-group/ProviderGroupRow.tsx
deleted file mode 100644
index 9d6496f662..0000000000
--- a/apps/desktop/src/renderer/features/provider-group/ProviderGroupRow.tsx
+++ /dev/null
@@ -1,38 +0,0 @@
-/**
- * 供应商详情里的「供应商组」一行(docs/product-rules/provider-groups.md §10):显示「未设置」或
- * 「{N} 台电脑 · {组策略}」,点击进入该供应商的「远程与分享」页。不依赖「允许被远程调用」:
- * 只给本机用时也可以建组。
- */
-import { useTranslation } from 'react-i18next';
-
-import { Button } from '@/components/ui/button';
-
-import { useProviderGroup } from './useProviderGroup';
-
-export function ProviderGroupRow({ providerId, onOpen }: { providerId: string; onOpen: () => void }) {
- const { t } = useTranslation();
- const { view } = useProviderGroup(providerId);
- const config = view?.config ?? null;
- return (
- <div
- data-testid="provider-group-row"
- className="flex shrink-0 items-start justify-between gap-3 border-t px-5 py-3"
- style={{ borderColor: 'var(--settings-theme-card-border)' }}
- >
- <div className="flex min-w-0 flex-col gap-1">
- <span className="text-13 font-medium text-[var(--text-primary)]">{t('providerGroup.row.label')}</span>
- <span className="text-12 leading-[1.4] text-[var(--text-tertiary)]" data-testid="provider-group-summary">
- {config
- ? t('providerGroup.row.summary', {
- count: config.members.length,
- strategy: t(`providerGroup.strategy.${config.strategy}`),
- })
- : t('providerGroup.row.description')}
- </span>
- </div>
- <Button variant="secondary" size="sm" compact onClick={onOpen}>
- {config ? t('providerGroup.row.manage') : t('providerGroup.row.setUp')}
- </Button>
- </div>
- );
-}
diff --git a/apps/desktop/src/renderer/features/provider-group/__tests__/ProviderGroupSection.test.tsx b/apps/desktop/src/renderer/features/provider-group/__tests__/ProviderGroupSection.test.tsx
index eeba13c973..9a773b50c2 100644
--- a/apps/desktop/src/renderer/features/provider-group/__tests__/ProviderGroupSection.test.tsx
+++ b/apps/desktop/src/renderer/features/provider-group/__tests__/ProviderGroupSection.test.tsx
@@ -1,14 +1,16 @@
// @vitest-environment jsdom
/**
- * 「远程与分享」页的供应商组一块:建组(本机默认在组里)、组内电脑状态、参与分配开关、组策略与自动换电脑。
+ * 「远程与分享」页的供应商组一块:建组(本机默认在组里)、组内电脑状态、参与分配开关、组策略与自动换电脑;
+ * 再次打开时先显示已知的组,不从「读取中」重来。
*/
-import { cleanup, fireEvent, render, screen, waitFor, within } from '@testing-library/react';
+import { act, cleanup, fireEvent, render, renderHook, screen, waitFor, within } from '@testing-library/react';
import type { ReactNode } from 'react';
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
import type { ProviderGroupConfig, ProviderGroupView } from '../../../../shared/providerGroup';
-import { ProviderGroupRow } from '../ProviderGroupRow';
import { ProviderGroupSection } from '../ProviderGroupSection';
+import { __testing as localGroupsTesting, useLocalProviderGroupsState } from '../useLocalProviderGroups';
+import { __testing as groupViewTesting } from '../useProviderGroup';
vi.mock('react-i18next', () => ({
initReactI18next: { type: '3rdParty', init: () => undefined },
@@ -89,9 +91,12 @@ function viewOf(config: ProviderGroupConfig | null): ProviderGroupView {
beforeEach(() => {
stored = null;
running = null;
+ localGroupsTesting.reset();
+ groupViewTesting.reset();
confirmSpy.mockClear();
command.mockReset();
command.mockImplementation(async (cmd: { action: string; config?: ProviderGroupConfig }) => {
+ if (cmd.action === 'list') return stored ? { anthropic: stored } : {};
if (cmd.action === 'get') return viewOf(stored);
if (cmd.action === 'candidates') {
return [
@@ -207,16 +212,48 @@ describe('ProviderGroupSection', () => {
});
});
-describe('ProviderGroupRow', () => {
- it('summarizes the group or offers to set one up', async () => {
- const onOpen = vi.fn();
- const { unmount } = render(<ProviderGroupRow providerId="anthropic" onOpen={onOpen} />);
- expect(await screen.findByRole('button', { name: 'providerGroup.row.setUp' })).toBeTruthy();
- unmount();
- stored = { strategy: 'order', autoSwitch: true, members: [LOCAL, MINI] };
- render(<ProviderGroupRow providerId="anthropic" onOpen={onOpen} />);
- fireEvent.click(await screen.findByRole('button', { name: 'providerGroup.row.manage' }));
- expect(onOpen).toHaveBeenCalled();
- expect(screen.getByTestId('provider-group-summary').textContent).toContain('"count":2');
+describe('ProviderGroupSection reopened', () => {
+ /** 让下一次「读组」(要逐台问状态,可能很慢)一直不回来。 */
+ function holdNextGet() {
+ command.mockImplementationOnce(() => new Promise(() => undefined));
+ }
+
+ it('shows the group it read last time right away while refreshing', async () => {
+ stored = { strategy: 'least', autoSwitch: true, members: [LOCAL, MINI] };
+ const first = render(<ProviderGroupSection providerId="anthropic" providerName="Anthropic" />);
+ expect(await screen.findAllByTestId('provider-group-member')).toHaveLength(2);
+ first.unmount();
+
+ holdNextGet();
+ render(<ProviderGroupSection providerId="anthropic" providerName="Anthropic" />);
+ const rows = screen.getAllByTestId('provider-group-member');
+ expect(rows).toHaveLength(2);
+ expect(rows[0].getAttribute('data-member-state')).toBe('available');
+ expect(screen.queryByText('providerGroup.section.loading')).toBeNull();
+ });
+
+ it('lays out the computers from the local group settings before their live state arrives', async () => {
+ stored = { strategy: 'least', autoSwitch: true, members: [LOCAL, MINI] };
+ const local = renderHook(() => useLocalProviderGroupsState());
+ await waitFor(() => expect(local.result.current.ready).toBe(true));
+
+ holdNextGet();
+ render(<ProviderGroupSection providerId="anthropic" providerName="Anthropic" />);
+ const rows = screen.getAllByTestId('provider-group-member');
+ expect(rows).toHaveLength(2);
+ // 状态还没读回来:先写「检查中」,不是「读取中」或「未设置」。
+ expect(rows[1].getAttribute('data-member-state')).toBe('loading');
+ expect(within(rows[1]).getByText('providerGroup.member.status.checking')).toBeTruthy();
+ expect(screen.queryByText(/providerGroup\.section\.empty/)).toBeNull();
+ });
+
+ it('shows the empty state at once when the local settings say there is no group', async () => {
+ const local = renderHook(() => useLocalProviderGroupsState());
+ await waitFor(() => expect(local.result.current.ready).toBe(true));
+
+ holdNextGet();
+ render(<ProviderGroupSection providerId="anthropic" providerName="Anthropic" />);
+ expect(screen.getByText(/providerGroup\.section\.empty/)).toBeTruthy();
+ await act(async () => undefined);
});
});
diff --git a/apps/desktop/src/renderer/features/provider-group/__tests__/useLocalProviderGroups.test.tsx b/apps/desktop/src/renderer/features/provider-group/__tests__/useLocalProviderGroups.test.tsx
index f40cfb6fe3..683f7d166c 100644
--- a/apps/desktop/src/renderer/features/provider-group/__tests__/useLocalProviderGroups.test.tsx
+++ b/apps/desktop/src/renderer/features/provider-group/__tests__/useLocalProviderGroups.test.tsx
@@ -1,13 +1,14 @@
// @vitest-environment jsdom
/**
* 本机供应商组快照按账号隔离:换账号后不沿用旧账号的组,旧账号迟到的读取结果丢弃。
+ * `ready` 区分「还没读到」与「没有组」,供应商详情据此不先显示「没有组」再跳成组。
*/
import { act, cleanup, renderHook, waitFor } from '@testing-library/react';
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
import { __testing as ownerTesting, setDataOwnerGeneration } from '@/contexts/dataOwnerGeneration';
import type { ProviderGroupConfig } from '../../../../shared/providerGroup';
-import { __testing, useLocalProviderGroups } from '../useLocalProviderGroups';
+import { __testing, useLocalProviderGroups, useLocalProviderGroupsState } from '../useLocalProviderGroups';
function group(label: string): Record<string, ProviderGroupConfig> {
return { anthropic: { members: [{ key: 'local', label }] } as unknown as ProviderGroupConfig };
@@ -91,4 +92,40 @@ describe('useLocalProviderGroups', () => {
});
await waitFor(() => expect(second.result.current.anthropic?.members[0].label).toBe('A2'));
});
+
+ it('is not ready until the first read finishes, and stays ready for the next component', async () => {
+ const first = deferred<Record<string, ProviderGroupConfig>>();
+ command.mockReturnValueOnce(first.promise);
+ const view = renderHook(() => useLocalProviderGroupsState());
+ expect(view.result.current).toEqual({ groups: {}, ready: false });
+ await act(async () => {
+ first.resolve(group('A'));
+ await first.promise;
+ });
+ await waitFor(() => expect(view.result.current.ready).toBe(true));
+ view.unmount();
+
+ const again = renderHook(() => useLocalProviderGroupsState());
+ expect(again.result.current.ready).toBe(true);
+ expect(again.result.current.groups.anthropic?.members[0].label).toBe('A');
+ expect(command).toHaveBeenCalledTimes(1);
+ });
+
+ it('becomes ready without groups when the read fails', async () => {
+ command.mockRejectedValueOnce(new Error('boom'));
+ const view = renderHook(() => useLocalProviderGroupsState());
+ await waitFor(() => expect(view.result.current).toEqual({ groups: {}, ready: true }));
+ });
+
+ it('forgets readiness after switching accounts', async () => {
+ command.mockResolvedValueOnce(group('A'));
+ const first = renderHook(() => useLocalProviderGroupsState());
+ await waitFor(() => expect(first.result.current.ready).toBe(true));
+ first.unmount();
+
+ command.mockReturnValueOnce(new Promise(() => undefined));
+ setDataOwnerGeneration('owner-b', 2);
+ const second = renderHook(() => useLocalProviderGroupsState());
+ expect(second.result.current).toEqual({ groups: {}, ready: false });
+ });
});
diff --git a/apps/desktop/src/renderer/features/provider-group/useLocalProviderGroups.ts b/apps/desktop/src/renderer/features/provider-group/useLocalProviderGroups.ts
index ff474d4edb..8c33f52c51 100644
--- a/apps/desktop/src/renderer/features/provider-group/useLocalProviderGroups.ts
+++ b/apps/desktop/src/renderer/features/provider-group/useLocalProviderGroups.ts
@@ -5,6 +5,9 @@
*
* 组设置属于当前账号:快照按账号代次存,换账号后清空重读,旧账号还在路上的结果直接丢弃——否则新账号的
* 模型列表会按旧账号的组收起供应商。
+ *
+ * `ready` 区分「还没读到」与「读到了、没有组」:供应商详情据此等第一次读完再显示组的状态,
+ * 不先显示「未设置」再跳成组(2026-10-11 用户反馈)。
*/
import { useEffect, useState } from 'react';
@@ -17,19 +20,26 @@ import type { ProviderGroupConfig } from '../../../shared/providerGroup';
type LocalGroups = Readonly<Record<string, ProviderGroupConfig>>;
+export interface LocalProviderGroupsState {
+ groups: LocalGroups;
+ /** 当前账号至少读完过一次(读失败也算,按没有组处理)。 */
+ ready: boolean;
+}
+
const EMPTY: LocalGroups = Object.freeze({});
interface GroupsState {
owner: DataOwnerGeneration | null;
snapshot: LocalGroups;
+ ready: boolean;
loaded: Promise<void> | null;
/** 每次重读或换账号加一,只认最后一次读取的结果。 */
revision: number;
}
-const state: GroupsState = { owner: null, snapshot: EMPTY, loaded: null, revision: 0 };
+const state: GroupsState = { owner: null, snapshot: EMPTY, ready: false, loaded: null, revision: 0 };
let offChanged: (() => void) | null = null;
-const listeners = new Set<(groups: LocalGroups) => void>();
+const listeners = new Set<() => void>();
function sameOwner(a: DataOwnerGeneration | null, b: DataOwnerGeneration): boolean {
return a?.dataOwnerId === b.dataOwnerId && a.generation === b.generation;
@@ -38,7 +48,10 @@ function sameOwner(a: DataOwnerGeneration | null, b: DataOwnerGeneration): boole
function stateFor(owner: DataOwnerGeneration): GroupsState {
if (!sameOwner(state.owner, owner)) {
// 同一账号只是代次变了(内部修复):保留快照免得组员闪出来,只重读一次;换了账号才清空。
- if (state.owner?.dataOwnerId !== owner.dataOwnerId) state.snapshot = EMPTY;
+ if (state.owner?.dataOwnerId !== owner.dataOwnerId) {
+ state.snapshot = EMPTY;
+ state.ready = false;
+ }
state.owner = owner;
state.loaded = null;
state.revision += 1;
@@ -46,23 +59,39 @@ function stateFor(owner: DataOwnerGeneration): GroupsState {
return state;
}
+function notify(): void {
+ for (const listener of listeners) listener();
+}
+
function reload(owner: DataOwnerGeneration): Promise<void> {
const api = window.electronAPI?.providerGroup;
- if (typeof api?.command !== 'function') return Promise.resolve();
stateFor(owner);
+ if (typeof api?.command !== 'function') {
+ // 读不到(旧窗口 / 测试)就当没有组,不让等 ready 的界面一直不出现。
+ if (!state.ready) {
+ state.ready = true;
+ notify();
+ }
+ return Promise.resolve();
+ }
const revision = ++state.revision;
+ const settle = (groups: LocalGroups | null) => {
+ if (revision !== state.revision || !sameOwner(state.owner, owner) || !isDataOwnerGenerationCurrent(owner)) return;
+ if (groups) state.snapshot = groups;
+ state.ready = true;
+ notify();
+ };
state.loaded = Promise.resolve()
.then(() => api.command({ action: 'list' }))
- .then((groups) => {
- if (revision !== state.revision || !sameOwner(state.owner, owner) || !isDataOwnerGenerationCurrent(owner)) return;
- state.snapshot = groups ?? EMPTY;
- for (const listener of listeners) listener(state.snapshot);
- })
+ .then(
+ (groups) => settle(groups ?? EMPTY),
+ () => settle(null),
+ )
.catch(() => undefined);
return state.loaded;
}
-function subscribe(owner: DataOwnerGeneration, listener: (groups: LocalGroups) => void): () => void {
+function subscribe(owner: DataOwnerGeneration, listener: () => void): () => void {
listeners.add(listener);
if (!stateFor(owner).loaded) void reload(owner);
offChanged ??= window.electronAPI?.providerGroup?.onChanged?.(() => void reload(getDataOwnerGeneration())) ?? null;
@@ -71,21 +100,36 @@ function subscribe(owner: DataOwnerGeneration, listener: (groups: LocalGroups) =
};
}
-export function useLocalProviderGroups(): LocalGroups {
+/** 不订阅,读一眼当前账号的快照:`ready` 为 false 时 `config` 为 null 不代表没有组。 */
+export function peekLocalProviderGroup(providerId: string): { ready: boolean; config: ProviderGroupConfig | null } {
+ const source = stateFor(getDataOwnerGeneration());
+ return { ready: source.ready, config: source.snapshot[providerId] ?? null };
+}
+
+function current(source: GroupsState): LocalProviderGroupsState {
+ return { groups: source.snapshot, ready: source.ready };
+}
+
+export function useLocalProviderGroupsState(): LocalProviderGroupsState {
const owner = getDataOwnerGeneration();
const source = stateFor(owner);
- const [view, setView] = useState(() => ({ owner, groups: source.snapshot }));
+ const [view, setView] = useState(() => ({ owner, value: current(source) }));
useEffect(() => {
- setView({ owner, groups: source.snapshot });
- return subscribe(owner, (groups) => setView({ owner, groups }));
+ setView({ owner, value: current(source) });
+ return subscribe(owner, () => setView({ owner, value: current(state) }));
}, [owner, source]);
- return view.owner === owner ? view.groups : source.snapshot;
+ return view.owner === owner ? view.value : current(source);
+}
+
+export function useLocalProviderGroups(): LocalGroups {
+ return useLocalProviderGroupsState().groups;
}
export const __testing = {
reset(): void {
state.owner = null;
state.snapshot = EMPTY;
+ state.ready = false;
state.loaded = null;
state.revision = 0;
offChanged?.();
diff --git a/apps/desktop/src/renderer/features/provider-group/useProviderGroup.ts b/apps/desktop/src/renderer/features/provider-group/useProviderGroup.ts
index 56a1339443..46cf40e504 100644
--- a/apps/desktop/src/renderer/features/provider-group/useProviderGroup.ts
+++ b/apps/desktop/src/renderer/features/provider-group/useProviderGroup.ts
@@ -1,14 +1,41 @@
/**
* 读取某个供应商的组(含组内电脑实时状态)。组设置变化时 main 广播 CHANGED;组内电脑的在线与
* 运行情况没有推送,打开期间定时重读。
+ *
+ * 读组要逐台问组内电脑的状态,可能要好几秒。所以打开时先显示已知的组,再在后台刷新
+ * (2026-10-11 用户反馈:每次进来都看到先「未设置」再跳成组):
+ * - 这个窗口读过就先用上次的结果(按账号存,换账号不沿用);
+ * - 没读过就用本机组设置快照(useLocalProviderGroups,全窗口共用、模型列表启动时就读好)排出组与组内电脑,
+ * 每台的状态先显示「检查中」,读回来再补上。
*/
import { useCallback, useEffect, useRef, useState } from 'react';
+import { getDataOwnerGeneration } from '@/contexts/dataOwnerGeneration';
import type { ProviderGroupConfig, ProviderGroupView } from '../../../shared/providerGroup';
+import { peekLocalProviderGroup } from './useLocalProviderGroups';
/** 组内电脑在线、正在运行等状态的重读间隔。 */
const REFRESH_INTERVAL_MS = 15_000;
+/** 上次读到的组,按「账号 + 供应商」存。 */
+const lastViews = new Map<string, ProviderGroupView>();
+
+function cacheKey(providerId: string): string {
+ return `${getDataOwnerGeneration().dataOwnerId ?? ''}\u0000${providerId}`;
+}
+
+function remember(providerId: string, view: ProviderGroupView): void {
+ lastViews.set(cacheKey(providerId), view);
+}
+
+/** 打开时先显示的组;null = 还不知道有没有组。 */
+function knownView(providerId: string): ProviderGroupView | null {
+ const cached = lastViews.get(cacheKey(providerId));
+ if (cached) return cached;
+ const local = peekLocalProviderGroup(providerId);
+ return local.ready ? { providerId, config: local.config, members: [] } : null;
+}
+
export interface ProviderGroupState {
view: ProviderGroupView | null;
loading: boolean;
@@ -19,8 +46,8 @@ export interface ProviderGroupState {
}
export function useProviderGroup(providerId: string, options: { live?: boolean } = {}): ProviderGroupState {
- const [view, setView] = useState<ProviderGroupView | null>(null);
- const [loading, setLoading] = useState(true);
+ const [view, setView] = useState<ProviderGroupView | null>(() => knownView(providerId));
+ const [loading, setLoading] = useState(() => knownView(providerId) === null);
const [failed, setFailed] = useState(false);
const seq = useRef(0);
@@ -29,6 +56,7 @@ export function useProviderGroup(providerId: string, options: { live?: boolean }
try {
const next = await window.electronAPI.providerGroup.command({ action: 'get', providerId });
if (current !== seq.current) return;
+ remember(providerId, next);
setView(next);
setFailed(false);
} catch {
@@ -40,8 +68,9 @@ export function useProviderGroup(providerId: string, options: { live?: boolean }
}, [providerId]);
useEffect(() => {
- setView(null);
- setLoading(true);
+ const known = knownView(providerId);
+ setView(known);
+ setLoading(known === null);
void reload();
const off = window.electronAPI.providerGroup.onChanged((event) => {
if (event?.providerId === providerId) void reload();
@@ -58,13 +87,17 @@ export function useProviderGroup(providerId: string, options: { live?: boolean }
return () => window.clearInterval(timer);
}, [options.live, reload]);
- const apply = useCallback((next: ProviderGroupView) => {
- seq.current += 1;
- setView(next);
- setFailed(false);
- setLoading(false);
- return next;
- }, []);
+ const apply = useCallback(
+ (next: ProviderGroupView) => {
+ seq.current += 1;
+ remember(providerId, next);
+ setView(next);
+ setFailed(false);
+ setLoading(false);
+ return next;
+ },
+ [providerId],
+ );
const save = useCallback(
async (config: ProviderGroupConfig) =>
@@ -79,3 +112,9 @@ export function useProviderGroup(providerId: string, options: { live?: boolean }
return { view, loading, failed, reload, save, remove };
}
+
+export const __testing = {
+ reset(): void {
+ lastViews.clear();
+ },
+};
diff --git a/apps/desktop/src/renderer/features/provider-share/ProviderShareEntryButton.tsx b/apps/desktop/src/renderer/features/provider-share/ProviderShareEntryButton.tsx
index 85a2460a60..7ab2489818 100644
--- a/apps/desktop/src/renderer/features/provider-share/ProviderShareEntryButton.tsx
+++ b/apps/desktop/src/renderer/features/provider-share/ProviderShareEntryButton.tsx
@@ -1,58 +1,54 @@
/**
- * 「允许被远程调用」一行开关左侧的「管理分享」图标按钮(产品规则 §7.1;设计稿场景 1)。
- * 能力未开启时不可点击,Tip 与无障碍名称说明需先开启哪一级;有待审批申请时带提示点。
+ * 「允许被远程调用」一行开关左侧的「远程与分享」入口(供应商分享 §7.1、供应商组 §10)。
+ *
+ * 2026-10-11 用户反馈供应商详情因「供应商组」多出一行而太长:原来的分享图标与「供应商组」一行合成这一个
+ * 胶囊按钮,有组时直接写「供应商组 · N 台电脑」,没有组时写「远程与分享」,点击都进同一页。
+ * 供应商组不依赖「允许被远程调用」(只给本机用也能建组),所以入口始终可点;分享未开启时由那一页说明先开哪一级。
+ * 有待审批的申请时右上角带提示点,Tip 与无障碍名称说明有几个。
*/
-import { Share2 } from 'lucide-react';
+import { ChevronRight } from 'lucide-react';
import { useTranslation } from 'react-i18next';
+import { Button } from '@/components/ui/button';
import { Tip } from '@/components/ui/tooltip';
-import { cn } from '@/lib/utils';
-
-import type { ProviderShareGate } from './providerShareFormat';
export function ProviderShareEntryButton({
- gate,
+ groupSize,
pendingCount,
onOpen,
}: {
- gate: ProviderShareGate;
+ /** 这个供应商的组里有几台电脑;null = 没有组。 */
+ groupSize: number | null;
pendingCount: number;
onOpen: () => void;
}) {
const { t } = useTranslation();
- const enabled = gate === 'on';
- const label = !enabled
- ? t(gate === 'remote-off' ? 'providerShare.entry.disabledRemoteControl' : 'providerShare.entry.disabledInvocation')
- : pendingCount > 0
- ? t('providerShare.entry.manageWithPending', { count: pendingCount })
- : t('providerShare.entry.manage');
+ const label =
+ groupSize === null
+ ? t('providerShare.entry.label')
+ : t('settings.providers.remote.groupBadge', { count: groupSize });
+ const pending = pendingCount > 0 ? t('providerShare.entry.pending', { count: pendingCount }) : null;
return (
- <Tip text={label}>
- <button
- type="button"
+ <Tip text={pending}>
+ <Button
+ variant="secondary"
+ size="sm"
+ compact
data-testid="provider-share-entry"
- aria-label={label}
- aria-disabled={enabled ? undefined : true}
- onClick={() => {
- if (enabled) onOpen();
- }}
- className={cn(
- 'relative flex h-7 w-7 shrink-0 items-center justify-center rounded-full text-[var(--text-secondary)] transition-colors',
- 'focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--focus-ring)]',
- enabled
- ? 'hover:bg-[var(--surface-hover)] hover:text-[var(--text-primary)]'
- : 'cursor-default opacity-50',
- )}
+ aria-label={pending ? `${label} · ${pending}` : undefined}
+ onClick={onOpen}
+ className="max-w-[240px] pr-2"
>
- <Share2 size={16} aria-hidden />
- {enabled && pendingCount > 0 && (
+ <span className="min-w-0 truncate">{label}</span>
+ <ChevronRight size={14} aria-hidden className="shrink-0 text-[var(--text-tertiary)]" />
+ {pending && (
<span
aria-hidden="true"
data-testid="provider-share-entry-dot"
- className="absolute right-1 top-1 h-[7px] w-[7px] rounded-full border-[1.5px] border-[var(--settings-theme-card-bg)] bg-[var(--text-primary)]"
+ className="absolute -right-0.5 -top-0.5 h-2 w-2 rounded-full border-[1.5px] border-[var(--settings-theme-card-bg)] bg-[var(--text-primary)]"
/>
)}
- </button>
+ </Button>
</Tip>
);
}
diff --git a/apps/desktop/src/renderer/features/provider-share/ProviderShareManagePage.tsx b/apps/desktop/src/renderer/features/provider-share/ProviderShareManagePage.tsx
index 476ade6d7a..0f8ca3b3d3 100644
--- a/apps/desktop/src/renderer/features/provider-share/ProviderShareManagePage.tsx
+++ b/apps/desktop/src/renderer/features/provider-share/ProviderShareManagePage.tsx
@@ -1,6 +1,6 @@
/**
- * 「{供应商} · 远程与分享」页(供应商分享 §7.2;供应商组 §10)。从设置 → 模型供应商的「管理分享」
- * 或「供应商组」进入,可返回。只列**这台电脑**上的设置:供应商组、待审批申请、已分享的人与按模型的用量。
+ * 「{供应商} · 远程与分享」页(供应商分享 §7.2;供应商组 §10)。从设置 → 模型供应商「允许被远程调用」一行的
+ * 「远程与分享」入口进入,可返回。只列**这台电脑**上的设置:供应商组、待审批申请、已分享的人与按模型的用量。
*
* 打开期间每次 OWNED_CHANGED 都按当前时间段重读(main 因此保持快速拉取,申请能尽快出现);
* 关闭、恢复、删除、同意、拒绝都立即生效,结果以 toast 说明。
@@ -186,7 +186,13 @@ export function ProviderShareManagePage({
const canCreateLink = gate === 'on' && ready;
return (
- <div className="flex h-full min-h-0 flex-col overflow-y-auto pb-8" data-testid="provider-share-manage">
+ // 这一页自己滚动(设置页外层在「模型供应商」分区不滚)。始终预留滚动条槽位:展开组内电脑的配额、
+ // 加载出已分享的人等让内容超过一屏时,滚动条出现不再把整页挤窄 12px(2026-10-11 用户反馈宽度跳变)。
+ // 槽位用 -mr-3 挪进外层右侧留白,内容宽度与「模型供应商」卡片保持一致。
+ <div
+ className="-mr-3 flex h-full min-h-0 flex-col overflow-y-auto pb-8 [scrollbar-gutter:stable]"
+ data-testid="provider-share-manage"
+ >
<button
type="button"
onClick={onBack}
diff --git a/apps/desktop/src/renderer/features/provider-share/__tests__/ProviderShareEntryButton.test.tsx b/apps/desktop/src/renderer/features/provider-share/__tests__/ProviderShareEntryButton.test.tsx
index 2169932421..74a0b65120 100644
--- a/apps/desktop/src/renderer/features/provider-share/__tests__/ProviderShareEntryButton.test.tsx
+++ b/apps/desktop/src/renderer/features/provider-share/__tests__/ProviderShareEntryButton.test.tsx
@@ -1,4 +1,8 @@
// @vitest-environment jsdom
+/**
+ * 「允许被远程调用」一行的「远程与分享」入口:有组时写组的台数,没有组时写「远程与分享」;
+ * 始终可点(供应商组不依赖远程调用);有待审批申请时带提示点。
+ */
import { cleanup, fireEvent, render, screen } from '@testing-library/react';
import { afterEach, describe, expect, it, vi } from 'vitest';
@@ -13,36 +17,27 @@ vi.mock('react-i18next', () => ({
afterEach(() => cleanup());
describe('ProviderShareEntryButton', () => {
- it('opens the management page when every capability is on', () => {
+ it('names the page when the provider has no group and opens it', () => {
const onOpen = vi.fn();
- render(<ProviderShareEntryButton gate="on" pendingCount={0} onOpen={onOpen} />);
+ render(<ProviderShareEntryButton groupSize={null} pendingCount={0} onOpen={onOpen} />);
const button = screen.getByTestId('provider-share-entry');
- expect(button.getAttribute('aria-label')).toBe('providerShare.entry.manage');
- expect(button.getAttribute('aria-disabled')).toBeNull();
+ expect(button.textContent).toBe('providerShare.entry.label');
+ expect(button.getAttribute('aria-label')).toBeNull();
expect(screen.queryByTestId('provider-share-entry-dot')).toBeNull();
fireEvent.click(button);
expect(onOpen).toHaveBeenCalledTimes(1);
});
+ it('shows how many computers the group has instead of a separate group row', () => {
+ render(<ProviderShareEntryButton groupSize={3} pendingCount={0} onOpen={vi.fn()} />);
+ expect(screen.getByTestId('provider-share-entry').textContent).toBe('settings.providers.remote.groupBadge:3');
+ });
+
it('shows a dot and the pending count when requests wait for approval', () => {
- render(<ProviderShareEntryButton gate="on" pendingCount={2} onOpen={vi.fn()} />);
+ render(<ProviderShareEntryButton groupSize={2} pendingCount={2} onOpen={vi.fn()} />);
expect(screen.getByTestId('provider-share-entry').getAttribute('aria-label')).toBe(
- 'providerShare.entry.manageWithPending:2',
+ 'settings.providers.remote.groupBadge:2 · providerShare.entry.pending:2',
);
expect(screen.getByTestId('provider-share-entry-dot')).toBeTruthy();
});
-
- it.each([
- ['invocation-off', 'providerShare.entry.disabledInvocation'],
- ['remote-off', 'providerShare.entry.disabledRemoteControl'],
- ] as const)('stays visible but unavailable when %s, explaining which step to enable', (gate, label) => {
- const onOpen = vi.fn();
- render(<ProviderShareEntryButton gate={gate} pendingCount={3} onOpen={onOpen} />);
- const button = screen.getByTestId('provider-share-entry');
- expect(button.getAttribute('aria-disabled')).toBe('true');
- expect(button.getAttribute('aria-label')).toBe(label);
- expect(screen.queryByTestId('provider-share-entry-dot')).toBeNull();
- fireEvent.click(button);
- expect(onOpen).not.toHaveBeenCalled();
- });
});
diff --git a/apps/desktop/src/renderer/i18n/locales/en/common.json b/apps/desktop/src/renderer/i18n/locales/en/common.json
index a6868fb96d..0df4766794 100644
--- a/apps/desktop/src/renderer/i18n/locales/en/common.json
+++ b/apps/desktop/src/renderer/i18n/locales/en/common.json
@@ -196,11 +196,9 @@
},
"providerShare": {
"entry": {
- "manage": "Manage Sharing",
- "manageWithPending_one": "Manage Sharing · {{count}} pending request",
- "manageWithPending_other": "Manage Sharing · {{count}} pending requests",
- "disabledInvocation": "Turn on “Allow remote use” to share this provider",
- "disabledRemoteControl": "Allow remote control in Remote Connection settings to share this provider",
+ "label": "Remote & Sharing",
+ "pending_one": "{{count}} share request waiting",
+ "pending_other": "{{count}} share requests waiting",
"remoteControlOff": "This computer doesn’t allow remote control yet, so its providers can’t be used remotely or shared.",
"openRemoteControl": "Open Remote Connection Settings",
"descriptionOff": "When on, your other computers and the people you share with can use this provider’s models. While it’s off, existing shares are paused, not deleted."
@@ -400,14 +398,6 @@
}
},
"providerGroup": {
- "row": {
- "label": "Provider Group",
- "description": "Combine this provider across your computers. Tasks are assigned automatically and move to another computer when one fails.",
- "summary_one": "{{count}} computer · {{strategy}}",
- "summary_other": "{{count}} computers · {{strategy}}",
- "setUp": "Set Up Group",
- "manage": "Manage Group"
- },
"page": {
"title": "{{provider}} · Remote & Sharing",
"shareTitle": "Sharing"
@@ -2896,6 +2886,7 @@
"remoteAccess": {
"label": "Allow remote use",
"description": "When on, your other computers and the people you share with can use this provider’s models. The Agent runs on this computer, using this computer’s sign-in and quota.",
+ "descriptionGroup": "When on, your other computers and the people you share with can use this provider’s models. The provider group picks the computer that runs the Agent.",
"ariaLabel": "Allow your other computers and the people you share with to use this provider",
"writeFailed": "Couldn't save the remote access setting. Please try again."
},
diff --git a/apps/desktop/src/renderer/i18n/locales/ja/common.json b/apps/desktop/src/renderer/i18n/locales/ja/common.json
index 974fbec36f..7abff5a418 100644
--- a/apps/desktop/src/renderer/i18n/locales/ja/common.json
+++ b/apps/desktop/src/renderer/i18n/locales/ja/common.json
@@ -196,10 +196,8 @@
},
"providerShare": {
"entry": {
- "manage": "共有を管理",
- "manageWithPending_other": "共有を管理 · 未処理の申請 {{count}} 件",
- "disabledInvocation": "共有するには、先に「リモート利用を許可」をオンにしてください",
- "disabledRemoteControl": "共有するには、先に「リモート接続」でこのパソコンの操作を許可してください",
+ "label": "リモートと共有",
+ "pending_other": "未処理の共有申請 {{count}} 件",
"remoteControlOff": "このパソコンはまだリモート操作を許可していないため、プロバイダーをリモートで利用したり共有したりできません。",
"openRemoteControl": "「リモート接続」設定を開く",
"descriptionOff": "オンにすると、あなたの他のパソコンと共有相手がこのプロバイダーのモデルを使えます。オフの間、既存の共有は一時的に使えなくなりますが、削除はされません。"
@@ -398,13 +396,6 @@
}
},
"providerGroup": {
- "row": {
- "label": "プロバイダーグループ",
- "description": "複数のパソコンのこのプロバイダーをまとめ、自動で割り当て、問題があれば別のパソコンに切り替えます",
- "summary_other": "{{count}} 台のパソコン · {{strategy}}",
- "setUp": "グループを設定",
- "manage": "グループを管理"
- },
"page": {
"title": "{{provider}} · リモートと共有",
"shareTitle": "共有"
@@ -2888,6 +2879,7 @@
"remoteAccess": {
"label": "リモート利用を許可",
"description": "オンにすると、あなたの他のパソコンと共有相手がこのプロバイダーのモデルを使えます。Agent はこのパソコン上で、このパソコンのサインインとクォータを使って実行されます。",
+ "descriptionGroup": "オンにすると、あなたの他のパソコンと共有相手がこのプロバイダーのモデルを使えます。Agent はプロバイダーグループが選んだパソコンで実行されます。",
"ariaLabel": "他のパソコンと共有相手にこのプロバイダーの利用を許可",
"writeFailed": "リモート利用の設定を保存できませんでした。もう一度お試しください。"
},
diff --git a/apps/desktop/src/renderer/i18n/locales/ko/common.json b/apps/desktop/src/renderer/i18n/locales/ko/common.json
index e09be47837..b8cb6106bd 100644
--- a/apps/desktop/src/renderer/i18n/locales/ko/common.json
+++ b/apps/desktop/src/renderer/i18n/locales/ko/common.json
@@ -196,10 +196,8 @@
},
"providerShare": {
"entry": {
- "manage": "공유 관리",
- "manageWithPending_other": "공유 관리 · 대기 중인 요청 {{count}}개",
- "disabledInvocation": "공유하려면 먼저 원격 사용 허용을 켜세요",
- "disabledRemoteControl": "공유하려면 먼저 원격 연결에서 이 컴퓨터의 제어를 허용하세요",
+ "label": "원격 및 공유",
+ "pending_other": "대기 중인 공유 요청 {{count}}개",
"remoteControlOff": "이 컴퓨터는 아직 원격 제어를 허용하지 않아 제공자를 원격으로 사용하거나 공유할 수 없습니다.",
"openRemoteControl": "원격 연결 설정 열기",
"descriptionOff": "켜면 내 다른 컴퓨터와 공유받은 사람이 이 제공자의 모델을 사용할 수 있습니다. 꺼져 있는 동안 기존 공유는 일시적으로 사용할 수 없지만 삭제되지는 않습니다."
@@ -398,13 +396,6 @@
}
},
"providerGroup": {
- "row": {
- "label": "제공자 그룹",
- "description": "여러 컴퓨터의 이 제공자를 하나로 묶어 자동으로 배정하고, 문제가 생기면 다른 컴퓨터로 전환합니다",
- "summary_other": "컴퓨터 {{count}}대 · {{strategy}}",
- "setUp": "그룹 설정",
- "manage": "그룹 관리"
- },
"page": {
"title": "{{provider}} · 원격 및 공유",
"shareTitle": "공유"
@@ -2888,6 +2879,7 @@
"remoteAccess": {
"label": "원격 사용 허용",
"description": "켜면 내 다른 컴퓨터와 공유받은 사람이 이 제공자의 모델을 사용할 수 있습니다. Agent는 이 컴퓨터에서 이 컴퓨터의 로그인과 할당량으로 실행됩니다.",
+ "descriptionGroup": "켜면 내 다른 컴퓨터와 공유받은 사람이 이 제공자의 모델을 사용할 수 있습니다. Agent는 제공자 그룹이 선택한 컴퓨터에서 실행됩니다.",
"ariaLabel": "내 다른 컴퓨터와 공유받은 사람이 이 제공자를 사용하도록 허용",
"writeFailed": "원격 사용 설정을 저장하지 못했습니다. 다시 시도해 주세요."
},
diff --git a/apps/desktop/src/renderer/i18n/locales/zh-CN/common.json b/apps/desktop/src/renderer/i18n/locales/zh-CN/common.json
index f6a9a325a5..120d9b891f 100644
--- a/apps/desktop/src/renderer/i18n/locales/zh-CN/common.json
+++ b/apps/desktop/src/renderer/i18n/locales/zh-CN/common.json
@@ -196,10 +196,8 @@
},
"providerShare": {
"entry": {
- "manage": "管理分享",
- "manageWithPending_other": "管理分享 · {{count}} 个待处理申请",
- "disabledInvocation": "先打开「允许被远程调用」才能分享",
- "disabledRemoteControl": "先在「远程连接」里允许同账号设备控制本机才能分享",
+ "label": "远程与分享",
+ "pending_other": "{{count}} 个分享申请待处理",
"remoteControlOff": "这台电脑还没有允许同账号设备远程控制,供应商不能被远程调用或分享。",
"openRemoteControl": "前往「远程连接」设置",
"descriptionOff": "开启后,你的其他电脑和你分享的人可以用这个供应商的模型。关闭期间,已有的分享暂时不可用,不会被删除。"
@@ -398,13 +396,6 @@
}
},
"providerGroup": {
- "row": {
- "label": "供应商组",
- "description": "把多台电脑上的这个供应商合成一组,自动分配,出问题自动换一台",
- "summary_other": "{{count}} 台电脑 · {{strategy}}",
- "setUp": "设置供应商组",
- "manage": "管理供应商组"
- },
"page": {
"title": "{{provider}} · 远程与分享",
"shareTitle": "分享"
@@ -2888,6 +2879,7 @@
"remoteAccess": {
"label": "允许被远程调用",
"description": "开启后,你的其他电脑和你分享的人可以用这个供应商的模型,Agent 在这台电脑上运行,使用这台电脑的登录和配额。",
+ "descriptionGroup": "开启后,你的其他电脑和你分享的人可以用这个供应商的模型,由供应商组选一台电脑运行 Agent。",
"ariaLabel": "允许你的其他电脑和你分享的人调用此供应商",
"writeFailed": "远程调用设置未能保存,请重试"
},
diff --git a/apps/desktop/src/renderer/i18n/locales/zh-TW/common.json b/apps/desktop/src/renderer/i18n/locales/zh-TW/common.json
index 61a27bae67..97a1505a69 100644
--- a/apps/desktop/src/renderer/i18n/locales/zh-TW/common.json
+++ b/apps/desktop/src/renderer/i18n/locales/zh-TW/common.json
@@ -196,10 +196,8 @@
},
"providerShare": {
"entry": {
- "manage": "管理分享",
- "manageWithPending_other": "管理分享 · {{count}} 個待處理申請",
- "disabledInvocation": "先開啟「允許遠端呼叫」才能分享",
- "disabledRemoteControl": "先在「遠端連線」裡允許同帳號裝置控制本機才能分享",
+ "label": "遠端與分享",
+ "pending_other": "{{count}} 個分享申請待處理",
"remoteControlOff": "這臺電腦還沒有允許同帳號裝置遠端控制,供應商不能被遠端呼叫或分享。",
"openRemoteControl": "前往「遠端連線」設定",
"descriptionOff": "開啟後,你的其他電腦和你分享的人可以用這個供應商的模型。關閉期間,已有的分享暫時無法使用,不會被刪除。"
@@ -398,13 +396,6 @@
}
},
"providerGroup": {
- "row": {
- "label": "供應商組",
- "description": "把多臺電腦上的這個供應商合成一組,自動分配,出問題自動換一臺",
- "summary_other": "{{count}} 臺電腦 · {{strategy}}",
- "setUp": "設定供應商組",
- "manage": "管理供應商組"
- },
"page": {
"title": "{{provider}} · 遠端與分享",
"shareTitle": "分享"
@@ -2888,6 +2879,7 @@
"remoteAccess": {
"label": "允許遠端呼叫",
"description": "開啟後,你的其他電腦和你分享的人可以用這個供應商的模型,Agent 在這臺電腦上執行,使用這臺電腦的登入和配額。",
+ "descriptionGroup": "開啟後,你的其他電腦和你分享的人可以用這個供應商的模型,由供應商組選一台電腦執行 Agent。",
"ariaLabel": "允許你的其他電腦和你分享的人呼叫此供應商",
"writeFailed": "遠端呼叫設定未能儲存,請重試"
},
diff --git a/docs/product-rules/provider-groups.md b/docs/product-rules/provider-groups.md
index 20624e7b9a..d996fd4fee 100644
--- a/docs/product-rules/provider-groups.md
+++ b/docs/product-rules/provider-groups.md
@@ -288,9 +288,13 @@
## 10. 界面
-- **入口**:供应商详情在「允许被远程调用」一行下方增加「供应商组」一行,显示「未设置」或
- 「{N} 台电脑 · {组策略}」,点击进入该供应商的「远程与分享」页。「允许被远程调用」一行的分享按钮进入同一页。
- 供应商组不依赖「允许被远程调用」:只给本机用时也可以建组。
+- **入口**(2026-10-11 用户反馈供应商详情多出一行太长,改为不单独占行):「允许被远程调用」一行开关左侧的入口按钮
+ 有组时写「供应商组 · {N} 台电脑」,没有组时写「远程与分享」,点击进入该供应商的「远程与分享」页(供应商分享 §7.1);
+ 组策略只在那一页显示。有组时这一行的说明改写「由供应商组选一台电脑运行 Agent」,不再说 Agent 在这台电脑上运行。
+ 供应商组不依赖「允许被远程调用」:入口始终可点,只给本机用时也可以建组。
+ - **不闪状态**:入口按钮读本机组设置(全窗口共用的快照),不等组内电脑的实时状态;第一次读完之前整行不出现,
+ 不先显示「没有组」再跳成组。「远程与分享」页再次打开时先显示上次读到的组,没读过就按本机组设置先排出组内电脑、
+ 状态写「检查中」,再在后台刷新。
- **「远程与分享」页**(原「分享 {供应商}」管理页扩展)分三块:
1. **供应商组**:组内电脑列表(来源、状态、正在运行的任务数、冷却到何时)、并发上限、添加电脑、组策略;
2. **用量**(P3):按使用方 / 按组内电脑切换,时间段切换,展开按模型;
diff --git a/docs/product-rules/provider-sharing.md b/docs/product-rules/provider-sharing.md
index 13152a1aa0..bceef2332d 100644
--- a/docs/product-rules/provider-sharing.md
+++ b/docs/product-rules/provider-sharing.md
@@ -57,8 +57,9 @@
1. 电脑打开「允许远程控制」,才能提供远程供应商;
2. 供应商打开「允许被远程调用」,才成为远程供应商;
3. 成为远程供应商后,才能分享给他人。
-- 前两级任一未开启时,「允许被远程调用」一行仍然显示,但开关或分享入口不可点击,并提示先开启
- 上一级(不再像现在这样整行隐藏)。
+- 前两级任一未开启时,「允许被远程调用」一行仍然显示,但开关不可点击,并提示先开启
+ 上一级(不再像现在这样整行隐藏)。这一行的「远程与分享」入口仍可进入(供应商组不依赖远程调用,§7.1),
+ 分享一块在管理页里置灰并说明先开启哪一级。
- 关闭任一级时,该供应商的全部分享**暂时不可用**,但不删除;重新开启后恢复。受邀者看到
「暂时不可用」而不是「已被删除」。
@@ -186,9 +187,11 @@ Desktop「设置 → 模型供应商」的左栏(2026-10-08 用户裁决):
### 7.1 入口
-供应商设置详情中「允许被远程调用」一行,在开关左侧增加一个分享图标按钮(「管理分享」,带 Tip 与
-无障碍名称),点击进入该供应商的分享管理页;有待审批申请时图标带提示点。能力未开启时按钮不可
-点击,Tip 说明需先开启哪一级(§3)。
+供应商设置详情中「允许被远程调用」一行,开关左侧是「远程与分享」入口按钮,点击进入该供应商的管理页
+([供应商组](provider-groups.md) §10 的「远程与分享」页)。2026-10-11 用户反馈详情因供应商组多出一行而太长:
+原来的分享图标与「供应商组」一行合并成这一个按钮——有组时写「供应商组 · N 台电脑」,没有组时写「远程与分享」。
+有待审批申请时按钮右上角带提示点,Tip 与无障碍名称写明有几个申请待处理。入口始终可点:供应商组不依赖
+「允许被远程调用」;分享未开启时由管理页说明需先开启哪一级(§3)。
### 7.2 管理页内容