From 84332bb0ef4ac5a8ef24795791eec25b8c04b87d Mon Sep 17 00:00:00 2001 From: suguanYang Date: Tue, 16 Jun 2026 03:53:29 +0000 Subject: [PATCH 01/14] Add notebook official library panel --- src/components/source-row.tsx | 33 +++++- src/components/sources-panel.test.ts | 54 +++++++++ src/components/sources-panel.tsx | 112 +++++++++++++++++- src/components/workspace-shell-layout.tsx | 18 +++ src/components/workspace-shell.tsx | 10 +- .../workspace-source-workflow.test.ts | 36 ++++++ src/components/workspace-source-workflow.ts | 39 ++++++ src/domains/demo/view.ts | 9 ++ src/domains/sources/route-service.test.ts | 2 + src/domains/sources/types.ts | 20 ++++ src/domains/workspace/initial-state.test.ts | 72 +++++++++++ src/domains/workspace/initial-state.ts | 30 ++++- src/integrations/knowhere-demo.test.ts | 77 ++++++++++++ src/integrations/knowhere-demo.ts | 110 ++++++++++++++++- 14 files changed, 612 insertions(+), 10 deletions(-) diff --git a/src/components/source-row.tsx b/src/components/source-row.tsx index 3fc2746..88ef432 100644 --- a/src/components/source-row.tsx +++ b/src/components/source-row.tsx @@ -1,7 +1,7 @@ "use client"; import type { ReactElement } from "react"; -import { FileText, Trash2 } from "lucide-react"; +import { FileText, Plus, Trash2 } from "lucide-react"; import { Checkbox } from "@/components/ui/checkbox"; import { Spinner } from "@/components/ui/spinner"; @@ -9,8 +9,10 @@ import type { SourceView } from "@/domains/sources/types"; export type SourceRowProps = { readonly isArchiving: boolean; + readonly isAdding?: boolean; readonly isNarrow?: boolean; readonly isSelected: boolean; + readonly onAddClick?: (sourceId: string) => void; readonly onArchiveClick?: (sourceId: string) => void; readonly onSelect: () => void; readonly onToggleIncluded?: (sourceId: string, included: boolean) => void; @@ -20,7 +22,9 @@ export type SourceRowProps = { export function SourceRow({ source, isSelected, + isAdding = false, isNarrow = false, + onAddClick, onSelect, onToggleIncluded, onArchiveClick, @@ -29,6 +33,7 @@ export function SourceRow({ const isReady = source.status === "ready"; const isBusy = source.status === "uploading" || source.status === "parsing"; const isFailed = source.status === "failed"; + const isLibrarySource = source.officialLibrary !== undefined; const iconBg = fileIconTint(source.title); @@ -49,7 +54,7 @@ export function SourceRow({ > onToggleIncluded?.(source.id, checked === true) } @@ -88,7 +93,9 @@ export function SourceRow({ }`} > {isReady - ? `Processed · ${source.chunkCount ?? 0} chunks` + ? `${isLibrarySource ? "Official Library" : "Processed"} · ${ + source.chunkCount ?? 0 + } chunks` : source.status === "parsing" ? "Preparing" : source.status === "uploading" @@ -97,6 +104,26 @@ export function SourceRow({