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(desktop): 修复供应商详情头重叠 (#2187)

Dash44473423e11a
diff --git a/apps/desktop/src/renderer/__tests__/providersSectionUnavailableModels.test.tsx b/apps/desktop/src/renderer/__tests__/providersSectionUnavailableModels.test.tsx
index 7e6340e5a2..85a974f78d 100644
--- a/apps/desktop/src/renderer/__tests__/providersSectionUnavailableModels.test.tsx
+++ b/apps/desktop/src/renderer/__tests__/providersSectionUnavailableModels.test.tsx
@@ -217,6 +217,12 @@ describe('ProvidersSection — 双栏管理', () => {
expect(
(await screen.findAllByText('settings.providers.xd.title')).length,
).toBeGreaterThanOrEqual(2);
+ // 详情标题的模型数/订阅标签必须在可用宽度内折行,不能溢出覆盖右侧连接操作。
+ const identity = screen.getByTestId('provider-detail-identity');
+ const metadata = screen.getByTestId('provider-detail-metadata');
+ expect(identity.contains(metadata)).toBe(true);
+ expect(identity.classList.contains('flex-auto')).toBe(true);
+ expect(metadata.classList.contains('flex-wrap')).toBe(true);
// 未连接的 Anthropic 不出现在左栏(无检测建议时整页不出现)。
expect(screen.queryByText('Anthropic')).toBeNull();
// xd 实时模型为空 → 详情仍渲染模型工具行与刷新入口,避免用户无从恢复。
diff --git a/apps/desktop/src/renderer/components/settings/ProvidersSection.tsx b/apps/desktop/src/renderer/components/settings/ProvidersSection.tsx
index 5304c9e91c..ff9737c131 100644
--- a/apps/desktop/src/renderer/components/settings/ProvidersSection.tsx
+++ b/apps/desktop/src/renderer/components/settings/ProvidersSection.tsx
@@ -340,42 +340,50 @@ function DetailHeader({
不被卡片 overflow-hidden 裁掉(PR #1102 review 第三轮)。 */}
<div className="flex flex-wrap items-center gap-3 gap-y-2">
<div
- className="flex h-9 w-9 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)',
- }}
+ data-testid="provider-detail-identity"
+ className="flex min-w-0 flex-auto items-center gap-3"
>
- {icon}
- </div>
+ <div
+ className="flex h-9 w-9 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}
+ </div>
- <div className="flex min-w-0 flex-1 flex-col gap-0.5">
- <div className="flex items-center gap-2">
+ <div className="flex min-w-0 flex-1 flex-col gap-0.5">
+ <div
+ data-testid="provider-detail-metadata"
+ className="flex min-w-0 flex-wrap items-center gap-2"
+ >
+ <span
+ className="min-w-0 truncate text-14 font-medium leading-tight"
+ style={{ color: 'var(--settings-section-title)' }}
+ >
+ {title}
+ </span>
+ {modelCount !== null && <ModelCountChip count={modelCount} />}
+ {subscriptionProduct && (
+ <CustomTag
+ label={t('settings.providers.models.subscriptionProduct', {
+ product: subscriptionProduct,
+ })}
+ />
+ )}
+ {provider?.suspended && <CustomTag label={t('settings.providers.pill.suspended')} />}
+ {badge}
+ </div>
<span
- className="min-w-0 truncate text-14 font-medium leading-tight"
- style={{ color: 'var(--settings-section-title)' }}
+ className="truncate text-13 leading-tight"
+ style={{ color: 'var(--settings-integration-subtitle)' }}
>
- {title}
+ {subtitle}
+ {singleAgentNote ? ` · ${singleAgentNote}` : ''}
</span>
- {modelCount !== null && <ModelCountChip count={modelCount} />}
- {subscriptionProduct && (
- <CustomTag
- label={t('settings.providers.models.subscriptionProduct', {
- product: subscriptionProduct,
- })}
- />
- )}
- {provider?.suspended && <CustomTag label={t('settings.providers.pill.suspended')} />}
- {badge}
</div>
- <span
- className="truncate text-13 leading-tight"
- style={{ color: 'var(--settings-integration-subtitle)' }}
- >
- {subtitle}
- {singleAgentNote ? ` · ${singleAgentNote}` : ''}
- </span>
</div>
{trailing}