feat: seed default dataset sources

This commit is contained in:
2026-07-23 15:14:31 +08:00
parent 26dd3004a1
commit b053c3874a
12 changed files with 183 additions and 9 deletions

View File

@@ -34,17 +34,17 @@ const visualExperts = [
]
let visualDatasetSources = [
{
id: '019b0000-0000-7000-8000-000000000030', name: '手动收集', kind: 'manual', url: '',
id: '019b0000-0000-7000-8000-000000000030', name: '手动收集', kind: 'manual', url: '', iconUrl: '',
description: '手动收集的文章与线索', enabled: true, lastSyncedAt: null, itemCount: 1,
createdAt: '2026-07-22T06:00:00Z', updatedAt: '2026-07-22T06:00:00Z',
},
{
id: '019b0000-0000-7000-8000-000000000031', name: '需求文档', kind: 'link', url: 'https://example.com/requirements',
id: '019b0000-0000-7000-8000-000000000031', name: '需求文档', kind: 'link', url: 'https://example.com/requirements', iconUrl: '',
description: '产品需求与业务文档', enabled: true, lastSyncedAt: null, itemCount: 1,
createdAt: '2026-07-22T06:00:00Z', updatedAt: '2026-07-22T06:00:00Z',
},
{
id: '019b0000-0000-7000-8000-000000000032', name: '架构讨论', kind: 'link', url: 'https://example.com/architecture',
id: '019b0000-0000-7000-8000-000000000032', name: '架构讨论', kind: 'link', url: 'https://example.com/architecture', iconUrl: '',
description: '架构方案与系统设计讨论', enabled: true, lastSyncedAt: null, itemCount: 0,
createdAt: '2026-07-22T06:00:00Z', updatedAt: '2026-07-22T06:00:00Z',
},

View File

@@ -753,6 +753,13 @@
font-size: 13px;
}
.explore-source-image {
width: 100%;
height: 100%;
border-radius: inherit;
object-fit: cover;
}
.explore-source-icon.blue {
background: rgb(var(--arcoblue-1));
color: rgb(var(--arcoblue-6));

View File

@@ -7,6 +7,7 @@ export type DatasetSourceDTO = {
name: string
kind: DatasetSourceKind
url: string
iconUrl: string
description: string
enabled: boolean
lastSyncedAt: string | null
@@ -46,6 +47,7 @@ export type DatasetSourceInput = {
name: string
kind: DatasetSourceKind
url: string
iconUrl: string
description: string
enabled: boolean
}

View File

@@ -35,6 +35,7 @@ type SourceDraft = {
name: string
kind: DatasetSourceKind
url: string
iconUrl: string
description: string
enabled: boolean
}
@@ -43,6 +44,7 @@ const EMPTY_SOURCE_DRAFT: SourceDraft = {
name: '',
kind: 'link',
url: '',
iconUrl: '',
description: '',
enabled: true,
}
@@ -105,6 +107,7 @@ export function WorkspaceExplorePage({
name: '全部',
kind: 'manual',
url: '',
iconUrl: '',
description: '全部探索内容',
enabled: true,
lastSyncedAt: null,
@@ -118,7 +121,9 @@ export function WorkspaceExplorePage({
allSource,
...sourceRecords.map((source) => ({
...source,
icon: sourceIcon(source.kind),
icon: source.iconUrl
? <img className="explore-source-image" src={source.iconUrl} alt="" />
: sourceIcon(source.kind),
color: sourceColor(source.kind),
})),
]
@@ -156,6 +161,7 @@ export function WorkspaceExplorePage({
name: source.name,
kind: source.kind,
url: source.url,
iconUrl: source.iconUrl,
description: source.description,
enabled: source.enabled,
})
@@ -168,6 +174,7 @@ export function WorkspaceExplorePage({
name: sourceDraft.name.trim(),
kind: sourceDraft.kind,
url: sourceDraft.url.trim(),
iconUrl: sourceDraft.iconUrl,
description: sourceDraft.description.trim(),
enabled: sourceDraft.enabled,
}