Skip to content

Commit 9e1ef48

Browse files
committed
fix: 移除快速填入推广并恢复密钥查看
1 parent 2dd725a commit 9e1ef48

18 files changed

Lines changed: 53 additions & 568 deletions

src/components/layout/MainLayout.tsx

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ import {
2222
IconSidebarOauth,
2323
IconSidebarPlugins,
2424
IconSidebarProviders,
25-
IconSidebarQuickStart,
2625
IconSidebarQuota,
2726
IconSidebarStore,
2827
IconSidebarSystem,
@@ -50,7 +49,6 @@ import type { Theme } from '@/types';
5049

5150
const sidebarIcons: Record<string, ReactNode> = {
5251
dashboard: <IconSidebarDashboard size={18} />,
53-
quickStart: <IconSidebarQuickStart size={18} />,
5452
aiProviders: <IconSidebarProviders size={18} />,
5553
authFiles: <IconSidebarAuthFiles size={18} />,
5654
oauth: <IconSidebarOauth size={18} />,
@@ -513,14 +511,6 @@ export function MainLayout() {
513511
})
514512
: [];
515513

516-
const quickStartNavItem: SidebarNavLinkItem = {
517-
path: '/quick-start',
518-
label: undefined,
519-
labelKey: 'nav.quick_start',
520-
metaKey: 'nav_meta.quick_start',
521-
icon: sidebarIcons.quickStart,
522-
};
523-
524514
const navGroups: SidebarNavGroup[] = [
525515
{
526516
id: 'operate',
@@ -532,7 +522,6 @@ export function MainLayout() {
532522
metaKey: 'nav_meta.dashboard',
533523
icon: sidebarIcons.dashboard,
534524
},
535-
...[quickStartNavItem],
536525
],
537526
},
538527
{

src/components/ui/icons.tsx

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -445,14 +445,6 @@ export function IconSidebarDashboard({ size = 20, ...props }: IconProps) {
445445
);
446446
}
447447

448-
export function IconSidebarQuickStart({ size = 20, ...props }: IconProps) {
449-
return (
450-
<svg {...baseSvgProps} width={size} height={size} {...props}>
451-
<path d="M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z" />
452-
</svg>
453-
);
454-
}
455-
456448
export const IconSidebarConfig = IconSlidersHorizontal;
457449

458450
export const IconSidebarPlugins = IconPlug;

src/features/providers/ProvidersWorkbenchPage.tsx

Lines changed: 34 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,7 @@ import { ProviderHeaderCard } from './components/ProviderHeaderCard';
1515
import { ProviderCategoryList } from './components/ProviderCategoryList';
1616
import { ProviderResourcePanel } from './components/ProviderResourcePanel';
1717
import type { ProviderPanelControls } from './components/ProviderResourcePanel';
18-
import { SponsorQuickStartPanel } from './components/SponsorQuickStartPanel';
1918
import { ProviderSheet, type ProviderSheetHandle } from './sheets/ProviderSheet';
20-
import { APIKEY_FUN_DISPLAY_NAME } from './sponsor';
2119
import { isMultiProtocolSponsorBrand } from './sponsorDefinitions';
2220
import { useProviderWorkbench } from './useProviderWorkbench';
2321
import {
@@ -43,6 +41,17 @@ interface ProvidersWorkbenchPageProps {
4341
fixedBrand?: ProviderBrand;
4442
}
4543

44+
// CPA 不展示上游内置的商业推广供应商。它们会把固定注册地址和服务地址带入管理页,
45+
// 与“由用户自行填写任意兼容供应商”的产品定位冲突;过滤必须放在页面数据入口,
46+
// 避免它们因同步上游后再次出现在提供商列表或“快速填入”分组中。
47+
const PROMOTIONAL_PROVIDER_BRANDS: ReadonlySet<ProviderBrand> = new Set([
48+
'apikeyFun',
49+
'code0',
50+
'fennoAI',
51+
'qiniuCloud',
52+
'claudeApi',
53+
]);
54+
4655
const formatDateTime = (iso: string, locale?: string) => {
4756
try {
4857
const date = new Date(iso);
@@ -149,10 +158,14 @@ export function ProvidersWorkbenchPage({ fixedBrand }: ProvidersWorkbenchPagePro
149158

150159
const allGroups = useMemo(() => workbench.snapshot?.groups ?? [], [workbench.snapshot]);
151160
const groups = useMemo(
152-
() =>
153-
fixedBrand
154-
? allGroups.filter((group) => group.id === fixedBrand)
155-
: allGroups.filter((group) => group.id !== 'apikeyFun'),
161+
() => {
162+
const visibleGroups = allGroups.filter(
163+
(group) => !PROMOTIONAL_PROVIDER_BRANDS.has(group.id)
164+
);
165+
return fixedBrand
166+
? visibleGroups.filter((group) => group.id === fixedBrand)
167+
: visibleGroups;
168+
},
156169
[allGroups, fixedBrand]
157170
);
158171
const firstVisibleBrand = groups[0]?.id ?? fixedBrand ?? 'gemini';
@@ -270,21 +283,9 @@ export function ProvidersWorkbenchPage({ fixedBrand }: ProvidersWorkbenchPagePro
270283
() => groups.filter((g) => g.resources.length > 0).length,
271284
[groups]
272285
);
273-
const quickStartResource = useMemo(
274-
() =>
275-
fixedBrand === 'apikeyFun' && activeGroup ? (activeGroup.resources[0] ?? null) : null,
276-
[activeGroup, fixedBrand]
277-
);
278-
279286
const updatedAtLabel = workbench.snapshot
280287
? formatDateTime(workbench.snapshot.fetchedAt, i18n.language)
281288
: t('providersPage.modelCatalog.notLoaded');
282-
const headerTitle =
283-
fixedBrand === 'apikeyFun'
284-
? quickStartResource
285-
? APIKEY_FUN_DISPLAY_NAME
286-
: t('nav.quick_start')
287-
: undefined;
288289

289290
const openCreate = useCallback(() => {
290291
const brand = activeBrand;
@@ -378,7 +379,6 @@ export function ProvidersWorkbenchPage({ fixedBrand }: ProvidersWorkbenchPagePro
378379
return (
379380
<div className={styles.page}>
380381
<ProviderHeaderCard
381-
title={headerTitle}
382382
totalActive={0}
383383
totalResources={0}
384384
providerFamilies={0}
@@ -388,7 +388,6 @@ export function ProvidersWorkbenchPage({ fixedBrand }: ProvidersWorkbenchPagePro
388388
onNew={() => {}}
389389
isNewDisabled
390390
showNewAction={!fixedBrand}
391-
showSummary={fixedBrand !== 'apikeyFun'}
392391
/>
393392
</div>
394393
);
@@ -397,17 +396,14 @@ export function ProvidersWorkbenchPage({ fixedBrand }: ProvidersWorkbenchPagePro
397396
return (
398397
<div className={styles.page}>
399398
<ProviderHeaderCard
400-
title={headerTitle}
401399
totalActive={totalActive}
402400
totalResources={totalResources}
403401
providerFamilies={providerFamilies}
404402
updatedAtLabel={updatedAtLabel}
405403
isFetching={workbench.isFetching}
406404
isNewDisabled={disableMutations}
407405
showNewAction={!fixedBrand}
408-
showSummary={fixedBrand !== 'apikeyFun'}
409406
newLabel={t('providersPage.actions.new')}
410-
variant={fixedBrand === 'apikeyFun' ? 'quickStart' : undefined}
411407
onRefresh={() => void handleRefresh()}
412408
onNew={openCreate}
413409
/>
@@ -433,29 +429,21 @@ export function ProvidersWorkbenchPage({ fixedBrand }: ProvidersWorkbenchPagePro
433429
}}
434430
/>
435431
) : null}
436-
{fixedBrand === 'apikeyFun' ? (
437-
<SponsorQuickStartPanel
438-
resource={quickStartResource}
439-
workbench={workbench}
440-
mutationDisabled={disableMutations}
441-
/>
442-
) : (
443-
<ProviderResourcePanel
444-
group={activeGroup}
445-
filter={filter}
446-
onFilterChange={(value) => updateActiveFilterState({ filter: value })}
447-
filteredResources={visibleResources}
448-
selectedId={sheetState.open ? (sheetState.resource?.id ?? null) : null}
449-
disableMutations={disableMutations}
450-
usageByProvider={usageByProvider}
451-
toolbarControls={toolbarControls}
452-
onView={openView}
453-
onEdit={openEdit}
454-
onDelete={handleDelete}
455-
onToggleDisabled={handleToggleDisabled}
456-
onCreate={openCreate}
457-
/>
458-
)}
432+
<ProviderResourcePanel
433+
group={activeGroup}
434+
filter={filter}
435+
onFilterChange={(value) => updateActiveFilterState({ filter: value })}
436+
filteredResources={visibleResources}
437+
selectedId={sheetState.open ? (sheetState.resource?.id ?? null) : null}
438+
disableMutations={disableMutations}
439+
usageByProvider={usageByProvider}
440+
toolbarControls={toolbarControls}
441+
onView={openView}
442+
onEdit={openEdit}
443+
onDelete={handleDelete}
444+
onToggleDisabled={handleToggleDisabled}
445+
onCreate={openCreate}
446+
/>
459447
</div>
460448

461449
{!fixedBrand ? (

src/features/providers/claudeApi.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ import type { ProviderKeyConfig } from '@/types';
22

33
export const CLAUDE_API_DISPLAY_NAME = 'ClaudeAPI';
44
export const CLAUDE_API_BASE_URL = 'https://gw.claudeapi.com';
5-
export const CLAUDE_API_AFFILIATE_URL =
6-
'https://console.claudeapi.com/agent/register/pJq9T52Fpugrhpgo';
5+
// CPA 不在管理页面或构建产物中分发供应商返利注册链接。
6+
export const CLAUDE_API_AFFILIATE_URL = '';
77

88
const normalizeBaseUrl = (value: string | undefined | null): string =>
99
String(value ?? '')

src/features/providers/code0.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@ import type { SponsorProviderRaw } from './types';
33

44
export const CODE0_PROVIDER_NAME = 'code0';
55
export const CODE0_DISPLAY_NAME = 'Code0';
6-
export const CODE0_AFFILIATE_URL = 'https://code0.ai/agent/register/slxVMR3uVBoRgNBf';
6+
// CPA 不在管理页面或构建产物中分发供应商返利注册链接。
7+
export const CODE0_AFFILIATE_URL = '';
78
export const CODE0_BASE_URL = 'https://code0.ai';
89
export const CODE0_OPENAI_BASE_URL = `${CODE0_BASE_URL}/v1`;
910
export const CODE0_CODEX_BASE_URL = CODE0_OPENAI_BASE_URL;

src/features/providers/components/ProviderCategoryList.tsx

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -9,19 +9,9 @@ interface ProviderCategoryListProps {
99
onSelect: (brand: ProviderBrand) => void;
1010
}
1111

12-
const QUICK_FILL_BRANDS: ReadonlySet<ProviderBrand> = new Set([
13-
'code0',
14-
'fennoAI',
15-
'qiniuCloud',
16-
'claudeApi',
17-
]);
18-
1912
export function ProviderCategoryList({ groups, activeBrand, onSelect }: ProviderCategoryListProps) {
2013
const { t } = useTranslation();
2114

22-
const quickFillGroups = groups.filter((g) => QUICK_FILL_BRANDS.has(g.id));
23-
const providerGroups = groups.filter((g) => !QUICK_FILL_BRANDS.has(g.id));
24-
2515
const renderGroups = (items: ProviderGroup[]) => (
2616
<div className={styles.list}>
2717
{items.map((group) => {
@@ -93,14 +83,8 @@ export function ProviderCategoryList({ groups, activeBrand, onSelect }: Provider
9383
<div className={styles.stack}>
9484
<aside className={styles.aside}>
9585
<p className={styles.eyebrow}>{t('providersPage.categories.title')}</p>
96-
{renderGroups(providerGroups)}
86+
{renderGroups(groups)}
9787
</aside>
98-
{quickFillGroups.length > 0 && (
99-
<aside className={styles.aside}>
100-
<p className={styles.eyebrow}>{t('providersPage.categories.quickFill')}</p>
101-
{renderGroups(quickFillGroups)}
102-
</aside>
103-
)}
10488
</div>
10589
);
10690
}

0 commit comments

Comments
 (0)