Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。
TypeScript agentai-agentai-assistantandroidclaude-codecodexelectroniosllmmacosreact-nativetypescriptwindows
fix(desktop): 收藏/全部里分享来的 Cindy AI 显示来源
ficowang667ebe3ee04a
diff --git a/apps/desktop/src/renderer/__tests__/remoteAgentDeviceFavoritesPanel.test.tsx b/apps/desktop/src/renderer/__tests__/remoteAgentDeviceFavoritesPanel.test.tsxindex 2322627e7e..e799568915 100644--- a/apps/desktop/src/renderer/__tests__/remoteAgentDeviceFavoritesPanel.test.tsx+++ b/apps/desktop/src/renderer/__tests__/remoteAgentDeviceFavoritesPanel.test.tsx@@ -33,6 +33,10 @@ vi.mock('react-i18next', async (importOriginal) => ({'newChat.modelSelector.unified.railAll': '全部','newChat.modelSelector.unified.railRemoteProvider': `${options?.provider ?? ''} · ${options?.device ?? ''}`,'newChat.modelSelector.unified.remoteFavoriteUnavailable': `${options?.source ?? ''} · 读不到`,+ 'newChat.modelSelector.unified.railRemoteProviderGroup': `${options?.provider ?? ''} · ${options?.device ?? ''} · ${options?.group ?? ''}`,+ 'settings.providers.remote.groupBadge': `供应商组 · ${options?.count ?? ''} 台电脑`,+ 'settings.providers.xd.title': 'Cindy AI',+ 'modelDescriptions.writingAndCoding': '用于内容写作、编程与问题分析。','effortLevels.low': '低','effortLevels.high': '高',};@@ -575,3 +579,119 @@ describe('收藏 / 全部聚合来源,供应商只筛自己的收藏', () => {resetProviderShareStoreForTests();});});++describe('Cindy AI(xd)来源行:只有本机自己的 Cindy AI 保留简介(#6110)', () => {+ const DESCRIPTION = '用于内容写作、编程与问题分析。';+ /** 分享者真实电脑名:界面任何位置都不能出现(provider-sharing.md §6)。 */+ const HOST_DEVICE_NAME = 'Magi-Secret-MacBook-Pro';+ const xdShare = {+ shareId: 'magi', memberId: 'member-magi', providerId: 'xd', providerLabel: 'Cindy AI',+ hostDeviceId: 'host-magi', deviceName: HOST_DEVICE_NAME, status: 'active' as const, hostOnline: true,+ hostCapable: true, owner: { displayName: 'Magi', avatarUrl: null, region: 'global' as const },+ };+ const xdDevices = [...devices, { deviceId: 'share:magi', name: '来自 Magi 的分享' }];+ const xdProvider = (models: readonly (readonly [string, string])[], extra: Record<string, unknown> = {}) => ({+ ...(catalogs.local[0] as Record<string, unknown>), id: 'xd', name: 'Cindy AI', ...extra,+ models: { 'claude-code': models.map(([id, name]) => ({ id, name, efforts: ['low', 'high'], defaultEffort: 'high' })) },+ });+ const LOCAL = 'GLM 5.3 Flash';+ const SHARED = 'Qwen 3.8 Flash';+ const REMOTE = 'GLM 5.2';+ let saved: { local: unknown[]; byDevice: Record<string, unknown[]> };++ const clickRail = async (key: string) => {+ await act(async () => fireEvent.click(document.querySelector(`[data-rail-item="${key}"]`)!));+ };+ const sourceOf = (row: HTMLElement) => row.querySelector('[data-model-source-details]')?.textContent ?? null;+ const rowsOf = (scope: HTMLElement, name: string) =>+ within(scope).getAllByText(name).map((node) => node.closest('[data-unified-anchor]') as HTMLElement);+ const expectDescription = (row: HTMLElement) => {+ expect(sourceOf(row)).toBeNull();+ expect(within(row).getByText(DESCRIPTION)).toBeTruthy();+ };+ const expectSource = (row: HTMLElement, label: string) => {+ expect(sourceOf(row)).toBe(label);+ expect(within(row).queryByText(DESCRIPTION)).toBeNull();+ };+ const SHARED_LABEL = 'Cindy AI · 来自 Magi 的分享 · 供应商组 · 2 台电脑';+ const REMOTE_LABEL = 'Cindy AI · Studio';++ beforeEach(() => {+ saved = { local: [...catalogs.local], byDevice: { ...catalogs.byDevice } };+ catalogs.local.push(xdProvider([['glm-5.3-flash', LOCAL]]));+ catalogs.byDevice['share:magi'] = [+ xdProvider([['qwen3.8-flash', SHARED]], { remoteInvocationEnabled: true, groupSize: 2 }),+ ];+ catalogs.byDevice['device-c'] = [+ ...catalogs.byDevice['device-c']!,+ xdProvider([['glm-5.2', REMOTE]], { remoteInvocationEnabled: true }),+ ];+ setDataOwnerGeneration('recipient', 1);+ setModelFavoritesOwner('recipient');+ reconcileProviderShareFavorites({+ received: [xdShare], confirmedRegions: ['global'],+ ownerStamp: { dataOwnerId: 'recipient', ownerGeneration: 1 },+ });+ addModelFavorite({ providerId: 'xd', modelId: 'glm-5.3-flash', agent: 'cc' });+ addModelFavorite({ providerId: providerShareFavoriteSource(xdShare), modelId: 'qwen3.8-flash', agent: 'cc' });+ addModelFavorite({+ providerId: agentDeviceFavoriteSource({ deviceId: 'device-c', providerId: 'xd' }),+ modelId: 'glm-5.2',+ agent: 'cc',+ });+ });+ afterEach(() => {+ catalogs.local.splice(0, catalogs.local.length, ...saved.local);+ for (const key of Object.keys(catalogs.byDevice)) delete catalogs.byDevice[key];+ Object.assign(catalogs.byDevice, saved.byDevice);+ });++ it.each(['favorites', 'all'])('「%s」:分享来的与其他电脑上的 Cindy AI 显示来源,本机 Cindy AI 保留简介', async (rail) => {+ renderPanel({ devices: xdDevices });+ await clickRail(rail);+ expectSource(rowOf(favoritesGroup(), SHARED), SHARED_LABEL);+ expectSource(rowOf(favoritesGroup(), REMOTE), REMOTE_LABEL);+ // 本机 Cindy AI:收藏区与「全部」里的供应商分组都只显示简介。+ for (const row of rowsOf(list(), LOCAL)) expectDescription(row);+ expect(document.body.textContent).not.toContain(HOST_DEVICE_NAME);+ });++ it('单供应商分栏保持现有简介写法', async () => {+ renderPanel({ devices: xdDevices });+ await clickRail('remote:share:magi:xd');+ for (const row of rowsOf(list(), SHARED)) expectDescription(row);+ await clickRail('remote:device-c:xd');+ for (const row of rowsOf(list(), REMOTE)) expectDescription(row);+ await clickRail('provider:xd');+ for (const row of rowsOf(list(), LOCAL)) expectDescription(row);+ });++ it('定宽测量行与可见行同一判断', async () => {+ renderPanel({ devices: xdDevices });+ await clickRail('favorites');+ const sizer = document.querySelector('[data-width-sizer]') as HTMLElement;+ expect(sizer).toBeTruthy();+ for (const row of rowsOf(sizer, SHARED)) expectSource(row, SHARED_LABEL);+ for (const row of rowsOf(sizer, REMOTE)) expectSource(row, REMOTE_LABEL);+ for (const row of rowsOf(sizer, LOCAL)) expectDescription(row);+ expect(sizer.textContent).not.toContain(HOST_DEVICE_NAME);+ });++ it('远程控制被控电脑时,那台自己的 Cindy AI 仍按任务所在电脑的目录显示简介', async () => {+ catalogs.byDevice['device-b'] = [xdProvider([['glm-5.3-flash', LOCAL]])];+ render(+ React.createElement(ModelSelectorContent, {+ modelId: 'glm-5.3-flash',+ effort: 'high',+ onModelChange: vi.fn(),+ onEffortChange: vi.fn(),+ currentProviderId: 'xd',+ onProviderChange: vi.fn(),+ vendorKey: 'cc',+ deviceId: 'device-b',+ }),+ );+ await act(async () => {});+ for (const row of rowsOf(list(), LOCAL)) expectDescription(row);+ });+});diff --git a/apps/desktop/src/renderer/components/new-chat/UnifiedModelPanel.tsx b/apps/desktop/src/renderer/components/new-chat/UnifiedModelPanel.tsxindex fb1b488c4a..935c7c3446 100644--- a/apps/desktop/src/renderer/components/new-chat/UnifiedModelPanel.tsx+++ b/apps/desktop/src/renderer/components/new-chat/UnifiedModelPanel.tsx@@ -1145,6 +1145,16 @@ export function UnifiedModelPanel({[priceOf, providers, t],);+ /**+ * 「全部 / 收藏」聚合行第二行的来源名。只有任务所在电脑自己目录里的 Cindy AI(xd)不带来源、+ * 保留单行简介(model-catalog-runtime.md);分享来的目录、正在浏览的其他电脑目录里的 xd 与其他+ * 供应商一样写来源,否则同名模型分不清来自哪里(#6110)。可见行与定宽 sizer 共用这一个判断。+ * 外来收藏(renderDeviceFavoriteRow)始终带来源,不经这里。+ */+ const ownCatalog = !isSharedProvider && !remoteSources?.active;+ const aggregateSourceLabel = (providerId: string): string | undefined =>+ ownCatalog && providerId === 'xd' ? undefined : providerLabel(providerId);+/*** 收藏区里另一台电脑上的收藏(见 resolveDeviceFavorite)。与本目录的行刻意分开画:* - 来源名带那台电脑(同浏览那台时的「供应商 · 电脑」),图标 / 账号 / 用量都按那台的目录读,@@ -1424,7 +1434,7 @@ export function UnifiedModelPanel({anchor={row.anchor}config={config}{...(effectiveRail.kind === 'all' || effectiveRail.kind === 'favorites'- ? { sourceLabel: providerLabel(row.entry.providerId) }+ ? { sourceLabel: aggregateSourceLabel(row.entry.providerId) }: {})}selected={isSelectedRow(row.anchor, row.entry)}active={sameAnchor(flyAnchor, row.anchor)}@@ -1497,7 +1507,7 @@ export function UnifiedModelPanel({entry={row.entry}anchor={row.anchor}config={config}- sourceLabel={providerLabel(row.entry.providerId)}+ sourceLabel={aggregateSourceLabel(row.entry.providerId)}selected={false}active={false}isFavoriteRow={!!row.favorite}diff --git a/apps/desktop/src/renderer/components/new-chat/UnifiedModelRow.tsx b/apps/desktop/src/renderer/components/new-chat/UnifiedModelRow.tsxindex 8e844f70ea..12b130edc0 100644--- a/apps/desktop/src/renderer/components/new-chat/UnifiedModelRow.tsx+++ b/apps/desktop/src/renderer/components/new-chat/UnifiedModelRow.tsx@@ -55,7 +55,10 @@ export function UnifiedModelRow({onPaymentRequired,sourceLabel,}: {- /** Supplied only in the combined All / Favorites views. */+ /**+ * Supplied only in the combined All / Favorites views; omitted = the local description.+ * The panel omits it only for this catalog's own Cindy AI (see UnifiedModelPanel aggregateSourceLabel).+ */sourceLabel?: string;entry: UnifiedModelEntry;anchor: UnifiedAnchor;@@ -306,7 +309,7 @@ export function UnifiedModelRow({还平白吃掉一列宽度);选中态语义由 aria-selected 承载。模型面板是输入框菜单「选中 = 勾 + 500」约定的唯一例外,2026-10-04 用户再次确认保留整行底色、不加勾。 */}</div>- {sourceLabel && entry.providerId !== 'xd' ? (+ {sourceLabel ? (<ModelSourceDetailsproviderId={entry.providerId}label={providerAccountLabel(diff --git a/docs/dev-rules/model-catalog-runtime.md b/docs/dev-rules/model-catalog-runtime.mdindex 2e84096a39..48b55b5ce1 100644--- a/docs/dev-rules/model-catalog-runtime.md+++ b/docs/dev-rules/model-catalog-runtime.md@@ -87,7 +87,7 @@ Desktop 模型选择器、旧入口的配置浮层及设置详情在展示简介`renderer/lib/modelDescriptions.ts` 解析本地简介,文案放在五语 `common.json` 的`modelDescriptions`。只写简短用途,不从文案推导能力、协议、价格、窗口或默认档位。-模型选择器的「全部」「收藏」分栏中,非 Cindy AI 模型的第二行优先展示供应商、+模型选择器的「全部」「收藏」分栏中,除任务所在电脑自己的 Cindy AI 外,模型的第二行优先展示供应商、已识别账号及可用的订阅套餐余量;账号已包含在供应商名称中时不重复追加。余量仅用重置倒计时和剩余百分比表示,不显示图表或周期标题。耗量告警仅作用于百分比,倒计时保持普通辅助文字色;过期窗口最多显示 10 分钟「重置中」,随后显示未知值,@@ -95,10 +95,13 @@ Desktop 模型选择器、旧入口的配置浮层及设置详情在展示简介费用符号、折扣和免费标签统一使用中性色,保留原价档位的符号个数、折扣明暗与百分比标签。整行不换行,长来源名称省略;额度段最多占行宽 70%,过长时省略,给来源保留可见空间,悬停仍可查看完整来源与额度状态。远程目录不读取本机账号余量,改读被控端用量镜像-(与会话用量 chip 共用同一缓存与推送,口径同 `useProviderWeeklyQuota.ts`);Cindy AI 及单供应商分栏-继续展示本地简介。实现见 `renderer/components/new-chat/ModelSourceDetails.tsx` 和-`UnifiedModelRow.tsx`,行为覆盖见 `renderer/__tests__/modelSourceDetails.test.tsx` 及-`unifiedModelPanelRendering.test.tsx`。+(与会话用量 chip 共用同一缓存与推送,口径同 `useProviderWeeklyQuota.ts`);任务所在电脑自己的 Cindy AI+及单供应商分栏继续展示本地简介。分享来的、同账号其他电脑上的 Cindy AI 以及外来收藏不属于这一例外,+与其他供应商一样展示来源(如 `Cindy AI · 来自 Magi 的分享`、`Cindy AI · 工作室 Mac`,#6110);是否属于+本机目录由 `UnifiedModelPanel` 判断,可见行与定宽测量行共用同一判断,`UnifiedModelRow` 收到来源即展示。+实现见 `renderer/components/new-chat/ModelSourceDetails.tsx` 和 `UnifiedModelRow.tsx`,行为覆盖见+`renderer/__tests__/modelSourceDetails.test.tsx`、`unifiedModelPanelRendering.test.tsx` 及+`remoteAgentDeviceFavoritesPanel.test.tsx`。同系列不同接入路径复用用途说明;特殊长上下文版本保留单独的费用提醒。媒体用途优先尊重明确的类型字段,不能因厂商分组是 GPT 就介绍成编程模型。diff --git a/docs/product-rules/provider-sharing.md b/docs/product-rules/provider-sharing.mdindex 1125dee97f..bfee9c1fa0 100644--- a/docs/product-rules/provider-sharing.md+++ b/docs/product-rules/provider-sharing.md@@ -123,6 +123,11 @@Desktop 与 Mobile 使用同一写法。+Desktop 模型选择器「全部」「收藏」里,分享来的模型每行第二行沿用上面的来源写法(含供应商组台数),+分享的是内置 Cindy AI 时也一样,写 `Cindy AI · 来自 Magi 的分享`;只有受邀者自己电脑上的 Cindy AI 在这里+显示模型简介(#6110,口径见[模型目录运行时](../dev-rules/model-catalog-runtime.md))。行内同样不写分享者的+电脑名(§6)。+### 5.2 供应商设置Desktop「设置 → 模型供应商」的左栏(2026-10-08 用户裁决):