@larkup/workspace-app 0.2.2 → 0.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist-types/components/data/corpus-panel.d.ts +2 -1
- package/dist-types/components/data/corpus-panel.d.ts.map +1 -1
- package/dist-types/components/data/data-workspace.d.ts.map +1 -1
- package/dist-types/components/data/project-data-page.d.ts.map +1 -1
- package/package.json +5 -5
- package/src/components/data/corpus-panel.tsx +17 -0
- package/src/components/data/data-workspace.tsx +18 -4
- package/src/components/data/project-data-page.tsx +7 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { SourceDocument, DataGroup } from '@larkup/core/types';
|
|
2
2
|
import { type VideoRuntimeScope } from '../../lib/media/video-runtime-scope';
|
|
3
|
-
export declare function CorpusPanel({ documents, groups, onChanged, isIndexing, activeVideoRuntimeScope, initialGroupId, isLoading, }: {
|
|
3
|
+
export declare function CorpusPanel({ documents, groups, onChanged, isIndexing, activeVideoRuntimeScope, initialGroupId, isLoading, error, }: {
|
|
4
4
|
documents: SourceDocument[];
|
|
5
5
|
groups?: DataGroup[];
|
|
6
6
|
onChanged: () => void | Promise<unknown>;
|
|
@@ -8,5 +8,6 @@ export declare function CorpusPanel({ documents, groups, onChanged, isIndexing,
|
|
|
8
8
|
activeVideoRuntimeScope: VideoRuntimeScope;
|
|
9
9
|
initialGroupId?: string;
|
|
10
10
|
isLoading?: boolean;
|
|
11
|
+
error?: string;
|
|
11
12
|
}): import("react").JSX.Element;
|
|
12
13
|
//# sourceMappingURL=corpus-panel.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"corpus-panel.d.ts","sourceRoot":"","sources":["../../../src/components/data/corpus-panel.tsx"],"names":[],"mappings":"AAqCA,OAAO,KAAK,EAAkB,cAAc,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AA+BpF,OAAO,EAGL,KAAK,iBAAiB,EACvB,MAAM,qCAAqC,CAAC;AAU7C,wBAAgB,WAAW,CAAC,EAC1B,SAAS,EACT,MAAW,EACX,SAAS,EACT,UAAU,EACV,uBAAuB,EACvB,cAAc,EACd,SAAS,
|
|
1
|
+
{"version":3,"file":"corpus-panel.d.ts","sourceRoot":"","sources":["../../../src/components/data/corpus-panel.tsx"],"names":[],"mappings":"AAqCA,OAAO,KAAK,EAAkB,cAAc,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AA+BpF,OAAO,EAGL,KAAK,iBAAiB,EACvB,MAAM,qCAAqC,CAAC;AAU7C,wBAAgB,WAAW,CAAC,EAC1B,SAAS,EACT,MAAW,EACX,SAAS,EACT,UAAU,EACV,uBAAuB,EACvB,cAAc,EACd,SAAS,EACT,KAAK,GACN,EAAE;IACD,SAAS,EAAE,cAAc,EAAE,CAAC;IAC5B,MAAM,CAAC,EAAE,SAAS,EAAE,CAAC;IACrB,SAAS,EAAE,MAAM,IAAI,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IACzC,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,uBAAuB,EAAE,iBAAiB,CAAC;IAC3C,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,+BAovBA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"data-workspace.d.ts","sourceRoot":"","sources":["../../../src/components/data/data-workspace.tsx"],"names":[],"mappings":"AAmEA,KAAK,QAAQ,GAAG,KAAK,GAAG,QAAQ,CAAC;AA+BjC,wBAAgB,aAAa,CAAC,EAAE,IAAI,EAAE,GAAE;IAAE,IAAI,CAAC,EAAE,QAAQ,CAAA;CAAO,+
|
|
1
|
+
{"version":3,"file":"data-workspace.d.ts","sourceRoot":"","sources":["../../../src/components/data/data-workspace.tsx"],"names":[],"mappings":"AAmEA,KAAK,QAAQ,GAAG,KAAK,GAAG,QAAQ,CAAC;AA+BjC,wBAAgB,aAAa,CAAC,EAAE,IAAI,EAAE,GAAE;IAAE,IAAI,CAAC,EAAE,QAAQ,CAAA;CAAO,+BA0hB/D"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"project-data-page.d.ts","sourceRoot":"","sources":["../../../src/components/data/project-data-page.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"project-data-page.d.ts","sourceRoot":"","sources":["../../../src/components/data/project-data-page.tsx"],"names":[],"mappings":"AAeA,kEAAkE;AAClE,wBAAgB,eAAe,gCA4C9B"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@larkup/workspace-app",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.3",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Canonical Larkup chat, data and settings pages with host adapters",
|
|
6
6
|
"files": [
|
|
@@ -534,7 +534,7 @@
|
|
|
534
534
|
"dependencies": {
|
|
535
535
|
"@ai-sdk/react": "4.0.136",
|
|
536
536
|
"@base-ui/react": "^1.5.0",
|
|
537
|
-
"@larkup/core": "^0.8.
|
|
537
|
+
"@larkup/core": "^0.8.2",
|
|
538
538
|
"ai": "7.0.133",
|
|
539
539
|
"class-variance-authority": "^0.7.1",
|
|
540
540
|
"clsx": "^2.1.1",
|
|
@@ -556,9 +556,9 @@
|
|
|
556
556
|
"@larkup/vector-stores": "^0.1.27",
|
|
557
557
|
"@larkup/sandbox": "^0.1.8",
|
|
558
558
|
"next": "16.3.8",
|
|
559
|
-
"@larkup/
|
|
560
|
-
"@larkup/
|
|
561
|
-
"@larkup/
|
|
559
|
+
"@larkup/tool-doc-editor": "0.3.2",
|
|
560
|
+
"@larkup/workspace-ui": "0.2.0",
|
|
561
|
+
"@larkup/integrations": "0.2.1"
|
|
562
562
|
},
|
|
563
563
|
"peerDependencies": {
|
|
564
564
|
"react": ">=19",
|
|
@@ -88,6 +88,7 @@ export function CorpusPanel({
|
|
|
88
88
|
activeVideoRuntimeScope,
|
|
89
89
|
initialGroupId,
|
|
90
90
|
isLoading,
|
|
91
|
+
error,
|
|
91
92
|
}: {
|
|
92
93
|
documents: SourceDocument[];
|
|
93
94
|
groups?: DataGroup[];
|
|
@@ -96,6 +97,7 @@ export function CorpusPanel({
|
|
|
96
97
|
activeVideoRuntimeScope: VideoRuntimeScope;
|
|
97
98
|
initialGroupId?: string;
|
|
98
99
|
isLoading?: boolean;
|
|
100
|
+
error?: string;
|
|
99
101
|
}) {
|
|
100
102
|
const [active, setActive] = useState<SourceDocument | null>(null);
|
|
101
103
|
const [deleteTask, setDeleteTask] = useState<
|
|
@@ -328,6 +330,21 @@ export function CorpusPanel({
|
|
|
328
330
|
return <CorpusSkeleton />;
|
|
329
331
|
}
|
|
330
332
|
|
|
333
|
+
if (error) {
|
|
334
|
+
return (
|
|
335
|
+
<div className="flex flex-col items-center justify-center rounded-lg border border-border bg-card/50 px-6 py-14 text-center">
|
|
336
|
+
<div className="size-10 p-1.5 bg-destructive/10 border border-destructive/20 rounded-md flex items-center justify-center text-destructive">
|
|
337
|
+
<Info className="size-6" />
|
|
338
|
+
</div>
|
|
339
|
+
<p className="mt-3 text-lg font-medium text-foreground">Could not load corpus data</p>
|
|
340
|
+
<p className="mt-1 max-w-xl text-sm text-muted-foreground">{error}</p>
|
|
341
|
+
<Button variant="outline" size="sm" className="mt-4" onClick={() => void onChanged()}>
|
|
342
|
+
Retry
|
|
343
|
+
</Button>
|
|
344
|
+
</div>
|
|
345
|
+
);
|
|
346
|
+
}
|
|
347
|
+
|
|
331
348
|
if (clearingAll || groupedDocuments.length === 0) {
|
|
332
349
|
return (
|
|
333
350
|
<div className="flex flex-col items-center justify-center rounded-lg px-6 py-14 text-center">
|
|
@@ -190,9 +190,13 @@ export function DataWorkspace({ view }: { view?: TopTabId } = {}) {
|
|
|
190
190
|
const completedJobs = jobs.filter((job) => job.status === 'completed');
|
|
191
191
|
const [jobsFilterTab, setJobsFilterTab] = useState<'running' | 'all'>('running');
|
|
192
192
|
|
|
193
|
-
const docsQuery = useSWR<DocsResponse>(
|
|
194
|
-
|
|
195
|
-
|
|
193
|
+
const docsQuery = useSWR<DocsResponse>(
|
|
194
|
+
serverId ? workspaceUrl('/api/documents') : null,
|
|
195
|
+
fetcher,
|
|
196
|
+
{
|
|
197
|
+
refreshInterval: hasActive ? 5000 : 0,
|
|
198
|
+
},
|
|
199
|
+
);
|
|
196
200
|
const { mutate: mutateDocuments } = docsQuery;
|
|
197
201
|
const documents = docsQuery.data?.documents ?? [];
|
|
198
202
|
const groups = docsQuery.data?.groups ?? [];
|
|
@@ -211,6 +215,9 @@ export function DataWorkspace({ view }: { view?: TopTabId } = {}) {
|
|
|
211
215
|
docsQuery.data !== undefined &&
|
|
212
216
|
!docsQuery.error &&
|
|
213
217
|
(targetGroupId === 'default' || selectedGroup !== undefined);
|
|
218
|
+
const isCorpusLoading = Boolean(
|
|
219
|
+
!serverId || docsQuery.isLoading || (docsQuery.data === undefined && !docsQuery.error),
|
|
220
|
+
);
|
|
214
221
|
|
|
215
222
|
useEffect(() => {
|
|
216
223
|
if (dataAddBlocked) setPrimaryAction(null);
|
|
@@ -613,7 +620,14 @@ export function DataWorkspace({ view }: { view?: TopTabId } = {}) {
|
|
|
613
620
|
isIndexing={indexRunning}
|
|
614
621
|
activeVideoRuntimeScope={activeVideoRuntimeScope}
|
|
615
622
|
initialGroupId={searchParams.has('groupId') ? queryGroupId : undefined}
|
|
616
|
-
isLoading={
|
|
623
|
+
isLoading={isCorpusLoading}
|
|
624
|
+
error={
|
|
625
|
+
docsQuery.error
|
|
626
|
+
? docsQuery.error instanceof Error
|
|
627
|
+
? docsQuery.error.message
|
|
628
|
+
: String(docsQuery.error)
|
|
629
|
+
: undefined
|
|
630
|
+
}
|
|
617
631
|
/>
|
|
618
632
|
</div>
|
|
619
633
|
)}
|
|
@@ -7,6 +7,7 @@ import { useRouter } from 'next/navigation';
|
|
|
7
7
|
import { Database, FolderOpen } from 'lucide-react';
|
|
8
8
|
import { WorkspaceLineTabs, WorkspacePageHeading } from '@larkup/workspace-ui';
|
|
9
9
|
import type { DataGroup } from '@larkup/core/types';
|
|
10
|
+
import { useProject } from '../projects/project-provider';
|
|
10
11
|
import { DataWorkspace } from './data-workspace';
|
|
11
12
|
import { GroupsPanel } from './groups-panel';
|
|
12
13
|
|
|
@@ -15,8 +16,13 @@ const fetcher = (url: string) => fetch(url).then((response) => response.json());
|
|
|
15
16
|
/** Simple, tab-first source management for the active Project. */
|
|
16
17
|
export function ProjectDataPage() {
|
|
17
18
|
const router = useRouter();
|
|
19
|
+
const { activeProject } = useProject();
|
|
20
|
+
const serverId = activeProject?.id;
|
|
18
21
|
const [activeView, setActiveView] = useState<'all' | 'groups'>('all');
|
|
19
|
-
const { data } = useSWR<{ groups: DataGroup[] }>(
|
|
22
|
+
const { data } = useSWR<{ groups: DataGroup[] }>(
|
|
23
|
+
serverId ? workspaceUrl('/api/groups') : null,
|
|
24
|
+
fetcher,
|
|
25
|
+
);
|
|
20
26
|
const groups = data?.groups ?? [];
|
|
21
27
|
|
|
22
28
|
return (
|