@elizaos/ui 2.0.3-beta.6 → 2.0.3-beta.7
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/App.d.ts.map +1 -1
- package/App.js +30 -4
- package/api/app-shell-capabilities.d.ts +9 -0
- package/api/app-shell-capabilities.d.ts.map +1 -0
- package/api/app-shell-capabilities.js +39 -0
- package/api/auth-client.d.ts.map +1 -1
- package/api/auth-client.js +4 -1
- package/api/client-agent.d.ts.map +1 -1
- package/api/client-agent.js +35 -24
- package/api/client-base.d.ts +36 -0
- package/api/client-base.d.ts.map +1 -1
- package/api/client-base.js +79 -0
- package/api/client-chat.d.ts.map +1 -1
- package/api/client-chat.js +14 -5
- package/api/client-cloud.d.ts +49 -0
- package/api/client-cloud.d.ts.map +1 -1
- package/api/client-cloud.js +73 -6
- package/api/client-local-inference.d.ts.map +1 -1
- package/api/client-local-inference.js +5 -1
- package/api/desktop-external-api-base.d.ts +4 -0
- package/api/desktop-external-api-base.d.ts.map +1 -0
- package/api/desktop-external-api-base.js +43 -0
- package/api/desktop-http-transport.d.ts.map +1 -1
- package/api/desktop-http-transport.js +2 -28
- package/api/i18n-locale-client.d.ts.map +1 -1
- package/api/i18n-locale-client.js +12 -0
- package/cloud/billing/components/billing-tab.d.ts.map +1 -1
- package/cloud/billing/components/billing-tab.js +11 -14
- package/cloud/connectors/discord-gateway-connection.d.ts.map +1 -1
- package/cloud/connectors/discord-gateway-connection.js +39 -5
- package/cloud/connectors/index.d.ts +9 -0
- package/cloud/connectors/index.d.ts.map +1 -1
- package/cloud/connectors/index.js +14 -1
- package/cloud/handoff/run-cloud-agent-handoff.d.ts +10 -1
- package/cloud/handoff/run-cloud-agent-handoff.d.ts.map +1 -1
- package/cloud/handoff/run-cloud-agent-handoff.js +43 -7
- package/cloud/handoff/silent-repoint.d.ts +33 -0
- package/cloud/handoff/silent-repoint.d.ts.map +1 -0
- package/cloud/handoff/silent-repoint.js +55 -0
- package/cloud/instances/AgentDetailPage.d.ts.map +1 -1
- package/cloud/instances/AgentDetailPage.js +2 -2
- package/cloud/instances/components/agent-actions.d.ts.map +1 -1
- package/cloud/instances/components/agent-actions.js +1 -4
- package/cloud/instances/components/eliza-agents-table.d.ts.map +1 -1
- package/cloud/instances/components/eliza-agents-table.js +1 -10
- package/cloud/instances/index.d.ts +2 -5
- package/cloud/instances/index.d.ts.map +1 -1
- package/cloud/instances/index.js +2 -12
- package/cloud/organization/invite-member-dialog.d.ts.map +1 -1
- package/cloud/organization/invite-member-dialog.js +2 -5
- package/cloud/organization/members-tab.d.ts.map +1 -1
- package/cloud/organization/members-tab.js +4 -7
- package/cloud/public-pages/pages/app-auth/app-authorize-page.d.ts +9 -0
- package/cloud/public-pages/pages/app-auth/app-authorize-page.d.ts.map +1 -1
- package/cloud/public-pages/pages/app-auth/app-authorize-page.js +11 -1
- package/cloud/register-all.d.ts +0 -1
- package/cloud/register-all.d.ts.map +1 -1
- package/cloud/register-all.js +3 -7
- package/cloud/settings/index.d.ts +5 -6
- package/cloud/settings/index.d.ts.map +1 -1
- package/cloud/settings/index.js +5 -6
- package/cloud/settings/register-cloud-settings.d.ts +2 -2
- package/cloud/settings/register-cloud-settings.d.ts.map +1 -1
- package/cloud/settings/register-cloud-settings.js +127 -121
- package/cloud/shell/CloudRouterShell.d.ts.map +1 -1
- package/cloud/shell/CloudRouterShell.js +5 -0
- package/cloud-ui/components/drawer.d.ts.map +1 -1
- package/cloud-ui/components/drawer.js +1 -1
- package/cloud-ui/index.d.ts +0 -1
- package/cloud-ui/index.d.ts.map +1 -1
- package/cloud-ui/index.js +0 -1
- package/components/apps/app-identity.helpers.d.ts.map +1 -1
- package/components/apps/app-identity.helpers.js +8 -0
- package/components/chat/widgets/inbox-unread.d.ts.map +1 -1
- package/components/chat/widgets/inbox-unread.js +8 -1
- package/components/chat/widgets/needs-attention.d.ts.map +1 -1
- package/components/chat/widgets/needs-attention.js +18 -2
- package/components/chat/widgets/relationships-attention.d.ts.map +1 -1
- package/components/chat/widgets/relationships-attention.js +5 -0
- package/components/composites/chat/chat-composer.js +15 -15
- package/components/config-ui/ui-renderer.d.ts.map +1 -1
- package/components/config-ui/ui-renderer.js +1 -1
- package/components/local-inference/useHomeModelStatus.d.ts.map +1 -1
- package/components/local-inference/useHomeModelStatus.js +31 -1
- package/components/pages/SettingsView.d.ts.map +1 -1
- package/components/pages/SettingsView.js +1 -4
- package/components/pages/Springboard.d.ts.map +1 -1
- package/components/pages/Springboard.js +17 -1
- package/components/pages/SpringboardSurface.d.ts.map +1 -1
- package/components/pages/SpringboardSurface.js +14 -3
- package/components/settings/CloudAgentsSection.d.ts.map +1 -1
- package/components/settings/CloudAgentsSection.js +6 -8
- package/components/settings/CloudOverviewSection.d.ts +2 -0
- package/components/settings/CloudOverviewSection.d.ts.map +1 -0
- package/components/settings/CloudOverviewSection.js +81 -0
- package/components/settings/ConnectorsSection.d.ts +19 -0
- package/components/settings/ConnectorsSection.d.ts.map +1 -1
- package/components/settings/ConnectorsSection.js +72 -27
- package/components/settings/settings-sections.d.ts.map +1 -1
- package/components/settings/settings-sections.js +26 -4
- package/components/shell/ComputerUseApprovalOverlay.d.ts.map +1 -1
- package/components/shell/ComputerUseApprovalOverlay.js +12 -2
- package/components/shell/ContinuousChatOverlay.d.ts.map +1 -1
- package/components/shell/ContinuousChatOverlay.js +41 -8
- package/components/shell/ShellHeaderControls.d.ts.map +1 -1
- package/components/shell/ShellHeaderControls.js +1 -1
- package/components/shell/StartupFailureView.d.ts.map +1 -1
- package/components/shell/StartupFailureView.js +4 -2
- package/components/shell/__e2e__/home-screen-fixture.catalog-stub.d.ts +2 -0
- package/components/shell/__e2e__/home-screen-fixture.catalog-stub.d.ts.map +1 -1
- package/components/shell/__e2e__/home-screen-fixture.catalog-stub.js +8 -0
- package/components/views/ViewTileImage.d.ts +4 -4
- package/components/views/ViewTileImage.d.ts.map +1 -1
- package/components/views/ViewTileImage.js +26 -9
- package/config/boot-config-store.d.ts +10 -0
- package/config/boot-config-store.d.ts.map +1 -1
- package/first-run/CompactOnboarding.d.ts.map +1 -1
- package/first-run/CompactOnboarding.js +4 -2
- package/first-run/use-first-run-controller.d.ts +1 -0
- package/first-run/use-first-run-controller.d.ts.map +1 -1
- package/first-run/use-first-run-controller.js +133 -56
- package/hooks/useAvailableViews.d.ts +11 -2
- package/hooks/useAvailableViews.d.ts.map +1 -1
- package/hooks/useAvailableViews.js +49 -7
- package/hooks/useHorizontalPager.d.ts.map +1 -1
- package/hooks/useHorizontalPager.js +11 -4
- package/hooks/useViewCatalog.d.ts.map +1 -1
- package/hooks/useViewCatalog.js +5 -2
- package/hooks/view-catalog.d.ts +2 -0
- package/hooks/view-catalog.d.ts.map +1 -1
- package/hooks/view-catalog.js +1 -0
- package/index.d.ts +0 -1
- package/index.d.ts.map +1 -1
- package/index.js +0 -1
- package/layouts/content-layout/content-layout.d.ts.map +1 -1
- package/layouts/content-layout/content-layout.js +2 -1
- package/package.json +10 -10
- package/platform/browser-launch.d.ts.map +1 -1
- package/platform/browser-launch.js +2 -0
- package/state/AppContext.js +6 -4
- package/state/startup-coordinator.d.ts +2 -0
- package/state/startup-coordinator.d.ts.map +1 -1
- package/state/startup-coordinator.js +8 -0
- package/state/startup-first-run-options.d.ts +4 -0
- package/state/startup-first-run-options.d.ts.map +1 -0
- package/state/startup-first-run-options.js +18 -0
- package/state/startup-phase-hydrate.d.ts.map +1 -1
- package/state/startup-phase-hydrate.js +25 -14
- package/state/startup-phase-poll.d.ts.map +1 -1
- package/state/startup-phase-poll.js +60 -0
- package/state/startup-phase-restore.d.ts.map +1 -1
- package/state/startup-phase-restore.js +6 -19
- package/state/types.d.ts +0 -17
- package/state/types.d.ts.map +1 -1
- package/state/types.js +0 -13
- package/state/use-startup-shell-controller.d.ts.map +1 -1
- package/state/use-startup-shell-controller.js +3 -2
- package/state/useAppShellState.d.ts +5 -1
- package/state/useAppShellState.d.ts.map +1 -1
- package/state/useAppShellState.js +11 -3
- package/state/useChatCallbacks.d.ts +1 -0
- package/state/useChatCallbacks.d.ts.map +1 -1
- package/state/useChatCallbacks.js +53 -8
- package/state/useChatLifecycle.d.ts +1 -0
- package/state/useChatLifecycle.d.ts.map +1 -1
- package/state/useChatLifecycle.js +2 -2
- package/state/useChatSend.d.ts.map +1 -1
- package/state/useChatSend.js +72 -8
- package/state/useCloudState.d.ts.map +1 -1
- package/state/useCloudState.js +29 -1
- package/state/useDataLoaders.d.ts.map +1 -1
- package/state/useDataLoaders.js +9 -0
- package/state/useFirstRunCallbacks.d.ts.map +1 -1
- package/state/useFirstRunCallbacks.js +5 -0
- package/state/useLifecycleState.d.ts +0 -7
- package/state/useLifecycleState.d.ts.map +1 -1
- package/state/useLifecycleState.js +0 -24
- package/state/usePluginsSkillsState.d.ts +2 -2
- package/state/useWalletState.d.ts +3 -1
- package/state/useWalletState.d.ts.map +1 -1
- package/state/useWalletState.js +4 -2
- package/storybook/mock-providers.d.ts.map +1 -1
- package/storybook/mock-providers.js +2 -0
- package/styles/electrobun-mac-window-drag.css +7 -0
- package/widgets/WidgetHost.d.ts.map +1 -1
- package/widgets/WidgetHost.js +21 -3
- package/cloud/documents/DocumentsRoute.d.ts +0 -21
- package/cloud/documents/DocumentsRoute.d.ts.map +0 -1
- package/cloud/documents/DocumentsRoute.js +0 -45
- package/cloud/documents/DocumentsSection.d.ts +0 -15
- package/cloud/documents/DocumentsSection.d.ts.map +0 -1
- package/cloud/documents/DocumentsSection.js +0 -18
- package/cloud/documents/components/document-list.d.ts +0 -19
- package/cloud/documents/components/document-list.d.ts.map +0 -1
- package/cloud/documents/components/document-list.js +0 -75
- package/cloud/documents/components/document-query.d.ts +0 -15
- package/cloud/documents/components/document-query.d.ts.map +0 -1
- package/cloud/documents/components/document-query.js +0 -92
- package/cloud/documents/components/document-upload.d.ts +0 -16
- package/cloud/documents/components/document-upload.d.ts.map +0 -1
- package/cloud/documents/components/document-upload.js +0 -180
- package/cloud/documents/components/documents-page-client.d.ts +0 -20
- package/cloud/documents/components/documents-page-client.d.ts.map +0 -1
- package/cloud/documents/components/documents-page-client.js +0 -80
- package/cloud/documents/index.d.ts +0 -37
- package/cloud/documents/index.d.ts.map +0 -1
- package/cloud/documents/index.js +0 -45
- package/cloud/documents/lib/agents.d.ts +0 -23
- package/cloud/documents/lib/agents.d.ts.map +0 -1
- package/cloud/documents/lib/agents.js +0 -26
- package/cloud/documents/lib/documents.d.ts +0 -54
- package/cloud/documents/lib/documents.d.ts.map +0 -1
- package/cloud/documents/lib/documents.js +0 -118
- package/cloud/instances/AgentChatPage.d.ts +0 -13
- package/cloud/instances/AgentChatPage.d.ts.map +0 -1
- package/cloud/instances/AgentChatPage.js +0 -217
- package/cloud-ui/components/image-gen/empty-state.d.ts +0 -3
- package/cloud-ui/components/image-gen/empty-state.d.ts.map +0 -1
- package/cloud-ui/components/image-gen/empty-state.js +0 -12
- package/cloud-ui/components/image-gen/enhanced-loading.d.ts +0 -14
- package/cloud-ui/components/image-gen/enhanced-loading.d.ts.map +0 -1
- package/cloud-ui/components/image-gen/enhanced-loading.js +0 -23
- package/cloud-ui/components/image-gen/index.d.ts +0 -5
- package/cloud-ui/components/image-gen/index.d.ts.map +0 -1
- package/cloud-ui/components/image-gen/index.js +0 -4
- package/cloud-ui/components/image-gen/loading-state.d.ts +0 -2
- package/cloud-ui/components/image-gen/loading-state.d.ts.map +0 -1
- package/cloud-ui/components/image-gen/loading-state.js +0 -11
- package/cloud-ui/components/image-gen/prompt-input.d.ts +0 -32
- package/cloud-ui/components/image-gen/prompt-input.d.ts.map +0 -1
- package/cloud-ui/components/image-gen/prompt-input.js +0 -24
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"DocumentsSection.d.ts","sourceRoot":"","sources":["../../../../../../src/cloud/documents/DocumentsSection.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAIH,wBAAgB,gBAAgB,4CAE/B"}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
/**
|
|
3
|
-
* Settings-section / view wrapper for the Documents (Knowledge) surface
|
|
4
|
-
* (Wave-3 mount point).
|
|
5
|
-
*
|
|
6
|
-
* Documents is an agent-scoped view (PLAN §"`dashboard/documents` → AGENT-VIEW
|
|
7
|
-
* (Knowledge)"); the per-character selector is the scope. The settings-section
|
|
8
|
-
* registry renders a no-prop `Component`, so this is the zero-prop adapter
|
|
9
|
-
* Wave 3 hands to `registerSettingsSection({ id: "documents", Component:
|
|
10
|
-
* DocumentsSection, ... })` (or mounts as a standalone view).
|
|
11
|
-
*
|
|
12
|
-
* It reuses the exact same {@link DocumentsSurface} as the standalone route, so
|
|
13
|
-
* the section and any direct mount stay identical.
|
|
14
|
-
*/
|
|
15
|
-
import { DocumentsSurface } from "./DocumentsRoute.js";
|
|
16
|
-
export function DocumentsSection() {
|
|
17
|
-
return _jsx(DocumentsSurface, {});
|
|
18
|
-
}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Document list table for the per-character knowledge view. Displays document
|
|
3
|
-
* metadata with relative timestamps and a confirm-gated delete.
|
|
4
|
-
*
|
|
5
|
-
* Ported from `@elizaos/cloud-frontend/src/dashboard/documents/_components/document-list.tsx`.
|
|
6
|
-
* Primitives now come from the canonical `components/ui/*` layer (relative
|
|
7
|
-
* imports, since this lives inside `@elizaos/ui`); the document type comes from
|
|
8
|
-
* the canonical `@elizaos/cloud-shared` DTO; translations from the cloud shell.
|
|
9
|
-
*/
|
|
10
|
-
import type { CloudDocument } from "@elizaos/cloud-shared/lib/types/documents";
|
|
11
|
-
interface DocumentListProps {
|
|
12
|
-
documents: CloudDocument[];
|
|
13
|
-
loading: boolean;
|
|
14
|
-
onDelete: (documentId: string) => Promise<void>;
|
|
15
|
-
onRefresh: () => void;
|
|
16
|
-
}
|
|
17
|
-
export declare function DocumentList({ documents, loading, onDelete, onRefresh, }: DocumentListProps): import("react/jsx-runtime").JSX.Element;
|
|
18
|
-
export {};
|
|
19
|
-
//# sourceMappingURL=document-list.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"document-list.d.ts","sourceRoot":"","sources":["../../../../../../../src/cloud/documents/components/document-list.tsx"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,2CAA2C,CAAC;AAyB/E,UAAU,iBAAiB;IACzB,SAAS,EAAE,aAAa,EAAE,CAAC;IAC3B,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,EAAE,CAAC,UAAU,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAChD,SAAS,EAAE,MAAM,IAAI,CAAC;CACvB;AAED,wBAAgB,YAAY,CAAC,EAC3B,SAAS,EACT,OAAO,EACP,QAAQ,EACR,SAAS,GACV,EAAE,iBAAiB,2CAqLnB"}
|
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
-
import { formatDistanceToNow } from "date-fns";
|
|
3
|
-
import { FileText, Loader2, RefreshCw, Trash2 } from "lucide-react";
|
|
4
|
-
import { useState } from "react";
|
|
5
|
-
import { AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogTitle, } from "../../../components/ui/alert-dialog.js";
|
|
6
|
-
import { Button } from "../../../components/ui/button.js";
|
|
7
|
-
import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow, } from "../../../components/ui/table.js";
|
|
8
|
-
import { useCloudT } from "../../shell/CloudI18nProvider.js";
|
|
9
|
-
export function DocumentList({ documents, loading, onDelete, onRefresh, }) {
|
|
10
|
-
const t = useCloudT();
|
|
11
|
-
const [deleteDialogOpen, setDeleteDialogOpen] = useState(false);
|
|
12
|
-
const [documentToDelete, setDocumentToDelete] = useState(null);
|
|
13
|
-
const [deleting, setDeleting] = useState(false);
|
|
14
|
-
const handleDeleteClick = (doc) => {
|
|
15
|
-
setDocumentToDelete(doc);
|
|
16
|
-
setDeleteDialogOpen(true);
|
|
17
|
-
};
|
|
18
|
-
const handleDeleteConfirm = async () => {
|
|
19
|
-
if (!documentToDelete)
|
|
20
|
-
return;
|
|
21
|
-
setDeleting(true);
|
|
22
|
-
await onDelete(documentToDelete.id);
|
|
23
|
-
setDeleteDialogOpen(false);
|
|
24
|
-
setDocumentToDelete(null);
|
|
25
|
-
setDeleting(false);
|
|
26
|
-
};
|
|
27
|
-
const getDocumentName = (doc) => doc.metadata?.fileName ||
|
|
28
|
-
doc.metadata?.originalFilename ||
|
|
29
|
-
t("cloud.documents.list.fallbackName", {
|
|
30
|
-
defaultValue: "Document {{id}}",
|
|
31
|
-
id: doc.id.slice(0, 8),
|
|
32
|
-
});
|
|
33
|
-
const getDocumentSize = (doc) => {
|
|
34
|
-
const size = doc.metadata?.fileSize;
|
|
35
|
-
if (!size)
|
|
36
|
-
return t("cloud.documents.list.unknownSize", { defaultValue: "Unknown" });
|
|
37
|
-
if (size < 1024)
|
|
38
|
-
return `${size} B`;
|
|
39
|
-
if (size < 1024 * 1024)
|
|
40
|
-
return `${(size / 1024).toFixed(2)} KB`;
|
|
41
|
-
return `${(size / (1024 * 1024)).toFixed(2)} MB`;
|
|
42
|
-
};
|
|
43
|
-
const getDocumentAge = (doc) => {
|
|
44
|
-
const timestamp = doc.metadata?.uploadedAt || doc.createdAt;
|
|
45
|
-
return formatDistanceToNow(new Date(timestamp), { addSuffix: true });
|
|
46
|
-
};
|
|
47
|
-
if (loading) {
|
|
48
|
-
return (_jsx("div", { className: "flex items-center justify-center py-12", children: _jsx(Loader2, { className: "h-8 w-8 animate-spin text-muted-foreground" }) }));
|
|
49
|
-
}
|
|
50
|
-
if (documents.length === 0) {
|
|
51
|
-
return (_jsxs("div", { className: "text-center py-12", children: [_jsx(FileText, { className: "h-12 w-12 text-muted-foreground mx-auto mb-4" }), _jsx("h3", { className: "text-lg font-semibold mb-2", children: t("cloud.documents.list.emptyTitle", {
|
|
52
|
-
defaultValue: "No files yet",
|
|
53
|
-
}) }), _jsx("p", { className: "text-muted-foreground mb-4", children: t("cloud.documents.list.emptyBody", {
|
|
54
|
-
defaultValue: "Upload your first file to get started.",
|
|
55
|
-
}) })] }));
|
|
56
|
-
}
|
|
57
|
-
return (_jsxs("div", { className: "space-y-4", children: [_jsxs("div", { className: "flex justify-between items-center", children: [_jsxs("p", { className: "text-sm text-muted-foreground", children: [documents.length, " ", documents.length !== 1
|
|
58
|
-
? t("cloud.documents.list.documentsPlural", {
|
|
59
|
-
defaultValue: "documents",
|
|
60
|
-
})
|
|
61
|
-
: t("cloud.documents.list.documentSingular", {
|
|
62
|
-
defaultValue: "document",
|
|
63
|
-
})] }), _jsxs(Button, { variant: "outline", size: "sm", onClick: onRefresh, children: [_jsx(RefreshCw, { className: "h-4 w-4 mr-2" }), t("cloud.documents.list.refresh", { defaultValue: "Refresh" })] })] }), _jsx("div", { className: "border rounded-sm", children: _jsxs(Table, { children: [_jsx(TableHeader, { children: _jsxs(TableRow, { children: [_jsx(TableHead, { children: t("cloud.documents.list.col.name", { defaultValue: "Name" }) }), _jsx(TableHead, { children: t("cloud.documents.list.col.size", { defaultValue: "Size" }) }), _jsx(TableHead, { children: t("cloud.documents.list.col.uploaded", {
|
|
64
|
-
defaultValue: "Uploaded",
|
|
65
|
-
}) }), _jsx(TableHead, { className: "text-right", children: t("cloud.documents.list.col.actions", {
|
|
66
|
-
defaultValue: "Actions",
|
|
67
|
-
}) })] }) }), _jsx(TableBody, { children: documents.map((doc) => (_jsxs(TableRow, { children: [_jsx(TableCell, { className: "font-medium", children: _jsxs("div", { className: "flex items-center gap-2", children: [_jsx(FileText, { className: "h-4 w-4 text-muted-foreground" }), _jsx("span", { className: "truncate max-w-[300px]", children: getDocumentName(doc) })] }) }), _jsx(TableCell, { children: getDocumentSize(doc) }), _jsx(TableCell, { className: "text-muted-foreground", children: getDocumentAge(doc) }), _jsx(TableCell, { className: "text-right", children: _jsx(Button, { variant: "ghost", size: "sm", onClick: () => handleDeleteClick(doc), children: _jsx(Trash2, { className: "h-4 w-4 text-destructive" }) }) })] }, doc.id))) })] }) }), _jsx(AlertDialog, { open: deleteDialogOpen, onOpenChange: setDeleteDialogOpen, children: _jsxs(AlertDialogContent, { children: [_jsxs(AlertDialogHeader, { children: [_jsx(AlertDialogTitle, { children: t("cloud.documents.list.deleteTitle", {
|
|
68
|
-
defaultValue: "Delete Document",
|
|
69
|
-
}) }), _jsx(AlertDialogDescription, { children: t("cloud.documents.list.deleteConfirm", {
|
|
70
|
-
defaultValue: 'Are you sure you want to delete "{{name}}"? This action cannot be undone.',
|
|
71
|
-
name: documentToDelete ? getDocumentName(documentToDelete) : "",
|
|
72
|
-
}) })] }), _jsxs(AlertDialogFooter, { children: [_jsx(AlertDialogCancel, { disabled: deleting, children: t("cloud.documents.list.cancel", { defaultValue: "Cancel" }) }), _jsx(AlertDialogAction, { onClick: handleDeleteConfirm, disabled: deleting, className: "bg-destructive text-destructive-foreground hover:bg-destructive/90", children: deleting ? (_jsxs(_Fragment, { children: [_jsx(Loader2, { className: "mr-2 h-4 w-4 animate-spin" }), t("cloud.documents.list.deleting", {
|
|
73
|
-
defaultValue: "Deleting...",
|
|
74
|
-
})] })) : (t("cloud.documents.list.delete", { defaultValue: "Delete" })) })] })] }) })] }));
|
|
75
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Document query: semantic search over the selected character's knowledge,
|
|
3
|
-
* rendering similarity-scored match cards.
|
|
4
|
-
*
|
|
5
|
-
* Ported from `@elizaos/cloud-frontend/src/dashboard/documents/_components/document-query.tsx`.
|
|
6
|
-
* Raw `fetch()` is replaced by the typed `useQueryDocuments` mutation; the
|
|
7
|
-
* 0..1 similarity → percent conversion stays in the shared isomorphic
|
|
8
|
-
* `toSuccessRatePercent` helper (no client-side math).
|
|
9
|
-
*/
|
|
10
|
-
interface DocumentQueryProps {
|
|
11
|
-
characterId: string | null;
|
|
12
|
-
}
|
|
13
|
-
export declare function DocumentQuery({ characterId }: DocumentQueryProps): import("react/jsx-runtime").JSX.Element;
|
|
14
|
-
export {};
|
|
15
|
-
//# sourceMappingURL=document-query.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"document-query.d.ts","sourceRoot":"","sources":["../../../../../../../src/cloud/documents/components/document-query.tsx"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAqBH,UAAU,kBAAkB;IAC1B,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;CAC5B;AAED,wBAAgB,aAAa,CAAC,EAAE,WAAW,EAAE,EAAE,kBAAkB,2CAoLhE"}
|
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
/**
|
|
3
|
-
* Document query: semantic search over the selected character's knowledge,
|
|
4
|
-
* rendering similarity-scored match cards.
|
|
5
|
-
*
|
|
6
|
-
* Ported from `@elizaos/cloud-frontend/src/dashboard/documents/_components/document-query.tsx`.
|
|
7
|
-
* Raw `fetch()` is replaced by the typed `useQueryDocuments` mutation; the
|
|
8
|
-
* 0..1 similarity → percent conversion stays in the shared isomorphic
|
|
9
|
-
* `toSuccessRatePercent` helper (no client-side math).
|
|
10
|
-
*/
|
|
11
|
-
import { toSuccessRatePercent } from "@elizaos/cloud-shared/lib/services/analytics-derived";
|
|
12
|
-
import { FileText, Loader2, Search } from "lucide-react";
|
|
13
|
-
import { useState } from "react";
|
|
14
|
-
import { Alert, AlertDescription } from "../../../components/ui/alert.js";
|
|
15
|
-
import { Button } from "../../../components/ui/button.js";
|
|
16
|
-
import { Card, CardContent, CardHeader, CardTitle, } from "../../../components/ui/card.js";
|
|
17
|
-
import { Input } from "../../../components/ui/input.js";
|
|
18
|
-
import { Label } from "../../../components/ui/label.js";
|
|
19
|
-
import { Slider } from "../../../components/ui/slider.js";
|
|
20
|
-
import { ApiError } from "../../lib/api-client.js";
|
|
21
|
-
import { useCloudT } from "../../shell/CloudI18nProvider.js";
|
|
22
|
-
import { useQueryDocuments } from "../lib/documents.js";
|
|
23
|
-
export function DocumentQuery({ characterId }) {
|
|
24
|
-
const t = useCloudT();
|
|
25
|
-
const queryDocuments = useQueryDocuments();
|
|
26
|
-
const [query, setQuery] = useState("");
|
|
27
|
-
const [limit, setLimit] = useState(5);
|
|
28
|
-
const [error, setError] = useState(null);
|
|
29
|
-
const [results, setResults] = useState([]);
|
|
30
|
-
const [hasSearched, setHasSearched] = useState(false);
|
|
31
|
-
const loading = queryDocuments.isPending;
|
|
32
|
-
const handleSearch = async (e) => {
|
|
33
|
-
e.preventDefault();
|
|
34
|
-
if (!query.trim()) {
|
|
35
|
-
setError(t("cloud.documents.query.enterQuery", {
|
|
36
|
-
defaultValue: "Please enter a search query",
|
|
37
|
-
}));
|
|
38
|
-
return;
|
|
39
|
-
}
|
|
40
|
-
setError(null);
|
|
41
|
-
setHasSearched(false);
|
|
42
|
-
try {
|
|
43
|
-
const found = await queryDocuments.mutateAsync({
|
|
44
|
-
query: query.trim(),
|
|
45
|
-
limit,
|
|
46
|
-
characterId,
|
|
47
|
-
});
|
|
48
|
-
setResults(found);
|
|
49
|
-
setHasSearched(true);
|
|
50
|
-
}
|
|
51
|
-
catch (err) {
|
|
52
|
-
const message = err instanceof ApiError || err instanceof Error
|
|
53
|
-
? err.message
|
|
54
|
-
: t("cloud.documents.query.queryFailed", {
|
|
55
|
-
defaultValue: "Failed to query documents",
|
|
56
|
-
});
|
|
57
|
-
setError(message);
|
|
58
|
-
}
|
|
59
|
-
};
|
|
60
|
-
const getSimilarityColor = (similarity) => {
|
|
61
|
-
if (similarity >= 0.8)
|
|
62
|
-
return "text-green-600";
|
|
63
|
-
if (similarity >= 0.6)
|
|
64
|
-
return "text-yellow-600";
|
|
65
|
-
return "text-red-600";
|
|
66
|
-
};
|
|
67
|
-
return (_jsxs("div", { className: "space-y-6", children: [_jsxs("form", { onSubmit: handleSearch, className: "space-y-4", children: [_jsxs("div", { children: [_jsx(Label, { htmlFor: "query", children: t("cloud.documents.query.searchQuery", {
|
|
68
|
-
defaultValue: "Search Query",
|
|
69
|
-
}) }), _jsxs("div", { className: "flex gap-2", children: [_jsx(Input, { id: "query", type: "text", placeholder: t("cloud.documents.query.placeholder", {
|
|
70
|
-
defaultValue: "Ask a question about your documents...",
|
|
71
|
-
}), value: query, onChange: (e) => setQuery(e.target.value), disabled: loading, className: "flex-1" }), _jsx(Button, { type: "submit", disabled: loading || !query.trim(), children: loading ? (_jsxs(_Fragment, { children: [_jsx(Loader2, { className: "mr-2 h-4 w-4 animate-spin" }), t("cloud.documents.query.searching", {
|
|
72
|
-
defaultValue: "Searching...",
|
|
73
|
-
})] })) : (_jsxs(_Fragment, { children: [_jsx(Search, { className: "mr-2 h-4 w-4" }), t("cloud.documents.query.search", {
|
|
74
|
-
defaultValue: "Search",
|
|
75
|
-
})] })) })] })] }), _jsxs("div", { children: [_jsxs(Label, { htmlFor: "limit", children: [t("cloud.documents.query.numberOfResults", {
|
|
76
|
-
defaultValue: "Number of Results",
|
|
77
|
-
}), ": ", _jsx("span", { className: "font-mono", children: limit })] }), _jsx(Slider, { id: "limit", min: 1, max: 10, step: 1, value: [limit], onValueChange: (values) => setLimit(values[0]), disabled: loading, className: "mt-2" })] })] }), error && (_jsx(Alert, { variant: "destructive", children: _jsx(AlertDescription, { children: error }) })), hasSearched && (_jsx("div", { className: "space-y-4", children: results.length === 0 ? (_jsxs("div", { className: "text-center py-12", children: [_jsx(FileText, { className: "h-12 w-12 text-muted-foreground mx-auto mb-4" }), _jsx("h3", { className: "text-lg font-semibold mb-2", children: t("cloud.documents.query.noResults", {
|
|
78
|
-
defaultValue: "No results found",
|
|
79
|
-
}) }), _jsx("p", { className: "text-muted-foreground", children: t("cloud.documents.query.noResultsBody", {
|
|
80
|
-
defaultValue: "Try a different query or upload more documents.",
|
|
81
|
-
}) })] })) : (_jsxs("div", { children: [_jsx("h3", { className: "text-lg font-semibold mb-4", children: t("cloud.documents.query.foundCount", {
|
|
82
|
-
defaultValue: "Found {{n}} result{{plural}}",
|
|
83
|
-
n: results.length,
|
|
84
|
-
plural: results.length !== 1 ? "s" : "",
|
|
85
|
-
}) }), _jsx("div", { className: "space-y-3", children: results.map((result, index) => (_jsxs(Card, { children: [_jsx(CardHeader, { className: "pb-3", children: _jsxs("div", { className: "flex items-center justify-between", children: [_jsx(CardTitle, { className: "text-sm font-medium", children: t("cloud.documents.query.resultNumber", {
|
|
86
|
-
defaultValue: "Result #{{n}}",
|
|
87
|
-
n: index + 1,
|
|
88
|
-
}) }), _jsx("span", { className: `text-sm font-mono ${getSimilarityColor(result.similarity)}`, children: t("cloud.documents.query.percentMatch", {
|
|
89
|
-
defaultValue: "{{p}}% match",
|
|
90
|
-
p: toSuccessRatePercent(result.similarity).toFixed(1),
|
|
91
|
-
}) })] }) }), _jsx(CardContent, { children: _jsx("p", { className: "text-sm text-muted-foreground whitespace-pre-wrap", children: result.content }) })] }, result.id))) })] })) }))] }));
|
|
92
|
-
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Document upload: drag-drop / file-picker upload and a paste-text tab, scoped
|
|
3
|
-
* to the selected character.
|
|
4
|
-
*
|
|
5
|
-
* Ported from `@elizaos/cloud-frontend/src/dashboard/documents/_components/document-upload.tsx`.
|
|
6
|
-
* Raw `fetch()` is replaced by the typed `useUploadFiles` / `useUploadText`
|
|
7
|
-
* mutations (which invalidate the list query on success), and the error path
|
|
8
|
-
* surfaces the structured `ApiError` message instead of re-parsing the body.
|
|
9
|
-
*/
|
|
10
|
-
interface DocumentUploadProps {
|
|
11
|
-
onUploadSuccess: () => void;
|
|
12
|
-
characterId: string | null;
|
|
13
|
-
}
|
|
14
|
-
export declare function DocumentUpload({ onUploadSuccess, characterId, }: DocumentUploadProps): import("react/jsx-runtime").JSX.Element;
|
|
15
|
-
export {};
|
|
16
|
-
//# sourceMappingURL=document-upload.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"document-upload.d.ts","sourceRoot":"","sources":["../../../../../../../src/cloud/documents/components/document-upload.tsx"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAmBH,UAAU,mBAAmB;IAC3B,eAAe,EAAE,MAAM,IAAI,CAAC;IAC5B,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;CAC5B;AAwCD,wBAAgB,cAAc,CAAC,EAC7B,eAAe,EACf,WAAW,GACZ,EAAE,mBAAmB,2CAuSrB"}
|
|
@@ -1,180 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
-
/**
|
|
3
|
-
* Document upload: drag-drop / file-picker upload and a paste-text tab, scoped
|
|
4
|
-
* to the selected character.
|
|
5
|
-
*
|
|
6
|
-
* Ported from `@elizaos/cloud-frontend/src/dashboard/documents/_components/document-upload.tsx`.
|
|
7
|
-
* Raw `fetch()` is replaced by the typed `useUploadFiles` / `useUploadText`
|
|
8
|
-
* mutations (which invalidate the list query on success), and the error path
|
|
9
|
-
* surfaces the structured `ApiError` message instead of re-parsing the body.
|
|
10
|
-
*/
|
|
11
|
-
import { CheckCircle2, FileText, Loader2, Upload } from "lucide-react";
|
|
12
|
-
import { useState } from "react";
|
|
13
|
-
import { Alert, AlertDescription } from "../../../components/ui/alert.js";
|
|
14
|
-
import { Button } from "../../../components/ui/button.js";
|
|
15
|
-
import { Input } from "../../../components/ui/input.js";
|
|
16
|
-
import { Label } from "../../../components/ui/label.js";
|
|
17
|
-
import { Tabs, TabsContent, TabsList, TabsTrigger, } from "../../../components/ui/tabs.js";
|
|
18
|
-
import { Textarea } from "../../../components/ui/textarea.js";
|
|
19
|
-
import { ApiError } from "../../lib/api-client.js";
|
|
20
|
-
import { useCloudT } from "../../shell/CloudI18nProvider.js";
|
|
21
|
-
import { useUploadFiles, useUploadText } from "../lib/documents.js";
|
|
22
|
-
/** Map a file extension to the MIME type the document plugin expects. */
|
|
23
|
-
const getCorrectMimeType = (file) => {
|
|
24
|
-
const ext = file.name.toLowerCase().split(".").pop() || "";
|
|
25
|
-
const mimeTypeMap = {
|
|
26
|
-
txt: "text/plain",
|
|
27
|
-
md: "text/markdown",
|
|
28
|
-
markdown: "text/markdown",
|
|
29
|
-
json: "application/json",
|
|
30
|
-
xml: "application/xml",
|
|
31
|
-
html: "text/html",
|
|
32
|
-
htm: "text/html",
|
|
33
|
-
css: "text/css",
|
|
34
|
-
csv: "text/csv",
|
|
35
|
-
yaml: "text/yaml",
|
|
36
|
-
yml: "text/yaml",
|
|
37
|
-
pdf: "application/pdf",
|
|
38
|
-
doc: "application/msword",
|
|
39
|
-
docx: "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
|
|
40
|
-
ts: "text/plain",
|
|
41
|
-
tsx: "text/plain",
|
|
42
|
-
js: "text/plain",
|
|
43
|
-
jsx: "text/plain",
|
|
44
|
-
py: "text/plain",
|
|
45
|
-
java: "text/plain",
|
|
46
|
-
c: "text/plain",
|
|
47
|
-
cpp: "text/plain",
|
|
48
|
-
go: "text/plain",
|
|
49
|
-
rs: "text/plain",
|
|
50
|
-
};
|
|
51
|
-
return mimeTypeMap[ext] || file.type || "application/octet-stream";
|
|
52
|
-
};
|
|
53
|
-
function errorMessage(error, fallback) {
|
|
54
|
-
if (error instanceof ApiError)
|
|
55
|
-
return error.message;
|
|
56
|
-
if (error instanceof Error && error.message)
|
|
57
|
-
return error.message;
|
|
58
|
-
return fallback;
|
|
59
|
-
}
|
|
60
|
-
export function DocumentUpload({ onUploadSuccess, characterId, }) {
|
|
61
|
-
const t = useCloudT();
|
|
62
|
-
const uploadFiles = useUploadFiles(characterId);
|
|
63
|
-
const uploadText = useUploadText(characterId);
|
|
64
|
-
const [error, setError] = useState(null);
|
|
65
|
-
const [success, setSuccess] = useState(null);
|
|
66
|
-
const [selectedFiles, setSelectedFiles] = useState([]);
|
|
67
|
-
const [textContent, setTextContent] = useState("");
|
|
68
|
-
const [filename, setFilename] = useState("");
|
|
69
|
-
const uploading = uploadFiles.isPending || uploadText.isPending;
|
|
70
|
-
const handleDragOver = (e) => {
|
|
71
|
-
e.preventDefault();
|
|
72
|
-
e.stopPropagation();
|
|
73
|
-
};
|
|
74
|
-
const handleDrop = (e) => {
|
|
75
|
-
e.preventDefault();
|
|
76
|
-
e.stopPropagation();
|
|
77
|
-
const files = Array.from(e.dataTransfer.files);
|
|
78
|
-
if (files.length > 0 && !uploading) {
|
|
79
|
-
setError(null);
|
|
80
|
-
setSuccess(null);
|
|
81
|
-
void handleFileUpload(files);
|
|
82
|
-
}
|
|
83
|
-
};
|
|
84
|
-
const handleFileUpload = async (files) => {
|
|
85
|
-
if (files.length === 0) {
|
|
86
|
-
setError(t("cloud.documents.upload.selectFile", {
|
|
87
|
-
defaultValue: "Please select at least one file",
|
|
88
|
-
}));
|
|
89
|
-
return;
|
|
90
|
-
}
|
|
91
|
-
setError(null);
|
|
92
|
-
setSuccess(null);
|
|
93
|
-
setSelectedFiles(files);
|
|
94
|
-
try {
|
|
95
|
-
const data = await uploadFiles.mutateAsync({
|
|
96
|
-
files,
|
|
97
|
-
mimeTypes: files.map(getCorrectMimeType),
|
|
98
|
-
characterId,
|
|
99
|
-
});
|
|
100
|
-
setSuccess(data.message ||
|
|
101
|
-
t("cloud.documents.upload.successfullyUploaded", {
|
|
102
|
-
defaultValue: "Successfully uploaded {{n}} file(s)",
|
|
103
|
-
n: files.length,
|
|
104
|
-
}));
|
|
105
|
-
setSelectedFiles([]);
|
|
106
|
-
const fileInput = document.getElementById("file-input");
|
|
107
|
-
if (fileInput)
|
|
108
|
-
fileInput.value = "";
|
|
109
|
-
onUploadSuccess();
|
|
110
|
-
}
|
|
111
|
-
catch (err) {
|
|
112
|
-
setSelectedFiles([]);
|
|
113
|
-
setError(errorMessage(err, t("cloud.documents.upload.uploadFailed", {
|
|
114
|
-
defaultValue: "Failed to upload files",
|
|
115
|
-
})));
|
|
116
|
-
}
|
|
117
|
-
};
|
|
118
|
-
const handleTextUpload = async (e) => {
|
|
119
|
-
e.preventDefault();
|
|
120
|
-
if (!textContent.trim()) {
|
|
121
|
-
setError(t("cloud.documents.upload.enterContent", {
|
|
122
|
-
defaultValue: "Please enter some text content",
|
|
123
|
-
}));
|
|
124
|
-
return;
|
|
125
|
-
}
|
|
126
|
-
setError(null);
|
|
127
|
-
setSuccess(null);
|
|
128
|
-
try {
|
|
129
|
-
const data = await uploadText.mutateAsync({
|
|
130
|
-
content: textContent,
|
|
131
|
-
filename: filename || "text-document.txt",
|
|
132
|
-
characterId,
|
|
133
|
-
});
|
|
134
|
-
setSuccess(data.message ?? null);
|
|
135
|
-
setTextContent("");
|
|
136
|
-
setFilename("");
|
|
137
|
-
onUploadSuccess();
|
|
138
|
-
}
|
|
139
|
-
catch (err) {
|
|
140
|
-
setError(errorMessage(err, t("cloud.documents.upload.uploadTextFailed", {
|
|
141
|
-
defaultValue: "Failed to upload text",
|
|
142
|
-
})));
|
|
143
|
-
}
|
|
144
|
-
};
|
|
145
|
-
return (_jsxs("div", { className: "space-y-6", children: [error && (_jsx(Alert, { variant: "destructive", children: _jsx(AlertDescription, { children: error }) })), success && (_jsxs(Alert, { className: "border-green-500 bg-green-50 dark:bg-green-950", children: [_jsx(CheckCircle2, { className: "h-4 w-4 text-green-600" }), _jsx(AlertDescription, { className: "text-green-600", children: success })] })), _jsxs(Tabs, { id: "document-upload-tabs", defaultValue: "file", className: "w-full", children: [_jsxs(TabsList, { className: "grid w-full grid-cols-2", children: [_jsx(TabsTrigger, { value: "file", children: t("cloud.documents.upload.tabFile", {
|
|
146
|
-
defaultValue: "Upload File",
|
|
147
|
-
}) }), _jsx(TabsTrigger, { value: "text", children: t("cloud.documents.upload.tabText", {
|
|
148
|
-
defaultValue: "Paste Text",
|
|
149
|
-
}) })] }), _jsx(TabsContent, { value: "file", className: "space-y-4", children: _jsxs("div", { className: "space-y-4", children: [_jsxs("section", { onDragOver: handleDragOver, onDrop: handleDrop, "aria-label": t("cloud.documents.upload.dropZoneAria", {
|
|
150
|
-
defaultValue: "File upload drop zone",
|
|
151
|
-
}), className: "relative border-2 border-dashed border-border rounded-sm hover:border-primary/50 transition-colors", children: [_jsx(Input, { id: "file-input", type: "file", multiple: true, accept: ".pdf,.txt,.md,.doc,.docx,.json,.xml,.yaml,.yml,.csv,.html,.js,.ts,.tsx,.jsx,.py,.java,.c,.cpp,.go,.rs", onChange: (e) => {
|
|
152
|
-
const files = e.target.files;
|
|
153
|
-
if (files && files.length > 0) {
|
|
154
|
-
setError(null);
|
|
155
|
-
setSuccess(null);
|
|
156
|
-
void handleFileUpload(Array.from(files));
|
|
157
|
-
}
|
|
158
|
-
}, disabled: uploading, className: "hidden" }), _jsx("label", { htmlFor: "file-input", className: `p-8 text-center cursor-pointer block ${uploading ? "opacity-50" : ""}`, children: uploadFiles.isPending ? (_jsxs("div", { className: "flex flex-col items-center gap-3", children: [_jsx(Loader2, { className: "h-8 w-8 animate-spin text-primary" }), _jsx("p", { className: "text-sm text-foreground font-medium", children: t("cloud.documents.upload.uploadingFiles", {
|
|
159
|
-
defaultValue: "Uploading files...",
|
|
160
|
-
}) })] })) : (_jsxs("div", { className: "flex flex-col items-center gap-3", children: [_jsx("div", { className: "p-3 rounded-full bg-muted", children: _jsx(Upload, { className: "h-6 w-6 text-muted-foreground" }) }), _jsxs("div", { children: [_jsxs("p", { className: "text-sm text-foreground font-medium mb-1", children: [t("cloud.documents.upload.dropOr", {
|
|
161
|
-
defaultValue: "Drop files here or",
|
|
162
|
-
}), " ", _jsx("span", { className: "text-primary", children: t("cloud.documents.upload.browse", {
|
|
163
|
-
defaultValue: "browse",
|
|
164
|
-
}) })] }), _jsx("p", { className: "text-xs text-muted-foreground", children: t("cloud.documents.upload.fileTypes", {
|
|
165
|
-
defaultValue: "PDF, TXT, MD, DOC, DOCX, JSON, and code files",
|
|
166
|
-
}) })] })] })) })] }), selectedFiles.length > 0 && (_jsxs("div", { className: "space-y-2", children: [_jsx("p", { className: "text-sm font-medium", children: t("cloud.documents.upload.uploadingNFiles", {
|
|
167
|
-
defaultValue: "Uploading {{n}} file(s)...",
|
|
168
|
-
n: selectedFiles.length,
|
|
169
|
-
}) }), selectedFiles.map((file) => (_jsxs("div", { className: "flex items-center gap-2 p-3 bg-muted rounded-sm", children: [_jsx(FileText, { className: "h-5 w-5 text-muted-foreground" }), _jsxs("div", { className: "flex-1", children: [_jsx("p", { className: "text-sm font-medium", children: file.name }), _jsxs("p", { className: "text-xs text-muted-foreground", children: [(file.size / 1024).toFixed(2), " KB"] })] }), _jsx(Loader2, { className: "h-4 w-4 animate-spin text-primary" })] }, file.name)))] }))] }) }), _jsx(TabsContent, { value: "text", className: "space-y-4", children: _jsxs("form", { onSubmit: handleTextUpload, className: "space-y-4", children: [_jsxs("div", { children: [_jsx(Label, { htmlFor: "filename", children: t("cloud.documents.upload.docNameLabel", {
|
|
170
|
-
defaultValue: "Document Name (Optional)",
|
|
171
|
-
}) }), _jsx(Input, { id: "filename", type: "text", placeholder: "my-document.txt", value: filename, onChange: (e) => setFilename(e.target.value), disabled: uploading })] }), _jsxs("div", { children: [_jsx(Label, { htmlFor: "text-content", children: t("cloud.documents.upload.contentLabel", {
|
|
172
|
-
defaultValue: "Content",
|
|
173
|
-
}) }), _jsx(Textarea, { id: "text-content", placeholder: t("cloud.documents.upload.contentPlaceholder", {
|
|
174
|
-
defaultValue: "Paste your text content here...",
|
|
175
|
-
}), value: textContent, onChange: (e) => setTextContent(e.target.value), disabled: uploading, rows: 10, className: "font-mono text-sm" })] }), _jsx(Button, { type: "submit", disabled: !textContent.trim() || uploading, children: uploadText.isPending ? (_jsxs(_Fragment, { children: [_jsx(Loader2, { className: "mr-2 h-4 w-4 animate-spin" }), t("cloud.documents.upload.processing", {
|
|
176
|
-
defaultValue: "Processing...",
|
|
177
|
-
})] })) : (_jsxs(_Fragment, { children: [_jsx(Upload, { className: "mr-2 h-4 w-4" }), t("cloud.documents.upload.uploadText", {
|
|
178
|
-
defaultValue: "Upload Text",
|
|
179
|
-
})] })) })] }) })] })] }));
|
|
180
|
-
}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Per-character knowledge surface: a character scope selector + three tabs
|
|
3
|
-
* (Documents / Upload / Query).
|
|
4
|
-
*
|
|
5
|
-
* Ported from `@elizaos/cloud-frontend/src/dashboard/documents/_components/documents-page-client.tsx`.
|
|
6
|
-
* The page's hand-rolled `PageState` + raw `fetch()` loading/error/503 machine
|
|
7
|
-
* is replaced by the typed `useDocuments` / `useDeleteDocument` hooks: list
|
|
8
|
-
* data, loading, and the service-unavailable (503) branch all come from
|
|
9
|
-
* react-query, and delete invalidates the list (no manual refetch wiring).
|
|
10
|
-
*/
|
|
11
|
-
export interface DocumentsPageCharacter {
|
|
12
|
-
id: string;
|
|
13
|
-
name: string;
|
|
14
|
-
}
|
|
15
|
-
interface DocumentsPageClientProps {
|
|
16
|
-
initialCharacters: DocumentsPageCharacter[];
|
|
17
|
-
}
|
|
18
|
-
export declare function DocumentsPageClient({ initialCharacters, }: DocumentsPageClientProps): import("react/jsx-runtime").JSX.Element;
|
|
19
|
-
export {};
|
|
20
|
-
//# sourceMappingURL=documents-page-client.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"documents-page-client.d.ts","sourceRoot":"","sources":["../../../../../../../src/cloud/documents/components/documents-page-client.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AA+BH,MAAM,WAAW,sBAAsB;IACrC,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;CACd;AAED,UAAU,wBAAwB;IAChC,iBAAiB,EAAE,sBAAsB,EAAE,CAAC;CAC7C;AAED,wBAAgB,mBAAmB,CAAC,EAClC,iBAAiB,GAClB,EAAE,wBAAwB,2CAsQ1B"}
|
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
-
/**
|
|
3
|
-
* Per-character knowledge surface: a character scope selector + three tabs
|
|
4
|
-
* (Documents / Upload / Query).
|
|
5
|
-
*
|
|
6
|
-
* Ported from `@elizaos/cloud-frontend/src/dashboard/documents/_components/documents-page-client.tsx`.
|
|
7
|
-
* The page's hand-rolled `PageState` + raw `fetch()` loading/error/503 machine
|
|
8
|
-
* is replaced by the typed `useDocuments` / `useDeleteDocument` hooks: list
|
|
9
|
-
* data, loading, and the service-unavailable (503) branch all come from
|
|
10
|
-
* react-query, and delete invalidates the list (no manual refetch wiring).
|
|
11
|
-
*/
|
|
12
|
-
import { Bot, InfoIcon, List, Search, Upload } from "lucide-react";
|
|
13
|
-
import { useEffect, useState } from "react";
|
|
14
|
-
import { DashboardSection } from "../../../cloud-ui/components/brand/dashboard-section.js";
|
|
15
|
-
import { Alert, AlertDescription } from "../../../components/ui/alert.js";
|
|
16
|
-
import { Card, CardContent, CardHeader, CardTitle, } from "../../../components/ui/card.js";
|
|
17
|
-
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue, } from "../../../components/ui/select.js";
|
|
18
|
-
import { Tabs, TabsContent, TabsList, TabsTrigger, } from "../../../components/ui/tabs.js";
|
|
19
|
-
import { useCloudT } from "../../shell/CloudI18nProvider.js";
|
|
20
|
-
import { useDeleteDocument, useDocuments } from "../lib/documents.js";
|
|
21
|
-
import { DocumentList } from "./document-list.js";
|
|
22
|
-
import { DocumentQuery } from "./document-query.js";
|
|
23
|
-
import { DocumentUpload } from "./document-upload.js";
|
|
24
|
-
export function DocumentsPageClient({ initialCharacters, }) {
|
|
25
|
-
const t = useCloudT();
|
|
26
|
-
const [activeTab, setActiveTab] = useState("documents");
|
|
27
|
-
const [isMounted, setIsMounted] = useState(false);
|
|
28
|
-
const [selectedCharacterId, setSelectedCharacterId] = useState(initialCharacters.length > 0 ? (initialCharacters[0].id ?? null) : null);
|
|
29
|
-
const documentsQuery = useDocuments(selectedCharacterId);
|
|
30
|
-
const deleteDocument = useDeleteDocument(selectedCharacterId);
|
|
31
|
-
useEffect(() => {
|
|
32
|
-
setIsMounted(true);
|
|
33
|
-
}, []);
|
|
34
|
-
const listState = documentsQuery.data;
|
|
35
|
-
const serviceUnavailable = listState?.status === "service-unavailable";
|
|
36
|
-
const documents = listState?.status === "ok" ? listState.documents : [];
|
|
37
|
-
const loading = selectedCharacterId !== null && documentsQuery.isLoading;
|
|
38
|
-
const listError = documentsQuery.error instanceof Error ? documentsQuery.error.message : null;
|
|
39
|
-
const handleDelete = async (documentId) => {
|
|
40
|
-
await deleteDocument.mutateAsync(documentId);
|
|
41
|
-
};
|
|
42
|
-
if (serviceUnavailable && !loading) {
|
|
43
|
-
return (_jsxs("div", { className: "container mx-auto py-8 space-y-4", children: [_jsx(DashboardSection, { label: t("cloud.documents.section.label", {
|
|
44
|
-
defaultValue: "Knowledge",
|
|
45
|
-
}), title: t("cloud.documents.section.title", {
|
|
46
|
-
defaultValue: "File Management",
|
|
47
|
-
}), description: t("cloud.documents.section.descShort", {
|
|
48
|
-
defaultValue: "Upload, index, and query agent documents from a single surface.",
|
|
49
|
-
}) }), _jsxs(Alert, { variant: "destructive", children: [_jsx(InfoIcon, { className: "h-4 w-4" }), _jsxs(AlertDescription, { children: [_jsx("p", { className: "font-semibold", children: t("cloud.documents.serviceUnavailable", {
|
|
50
|
-
defaultValue: "Service unavailable",
|
|
51
|
-
}) }), listState.message && (_jsx("p", { className: "text-sm mt-1", children: listState.message }))] })] })] }));
|
|
52
|
-
}
|
|
53
|
-
return (_jsxs("div", { className: "container mx-auto py-8 space-y-6", children: [_jsxs("div", { className: "space-y-4", children: [_jsx(DashboardSection, { label: t("cloud.documents.section.label", {
|
|
54
|
-
defaultValue: "Knowledge",
|
|
55
|
-
}), title: t("cloud.documents.section.title", {
|
|
56
|
-
defaultValue: "File Management",
|
|
57
|
-
}), description: t("cloud.documents.section.descLong", {
|
|
58
|
-
defaultValue: "Upload and manage documents for your agents. These files provide context and information for enhanced AI responses.",
|
|
59
|
-
}) }), initialCharacters.length > 0 && (_jsxs(Select, { value: selectedCharacterId || undefined, onValueChange: (v) => setSelectedCharacterId(v), children: [_jsxs(SelectTrigger, { className: "w-full max-w-xs", children: [_jsx(Bot, { className: "h-4 w-4 mr-2" }), _jsx(SelectValue, { placeholder: t("cloud.documents.selectAgent", {
|
|
60
|
-
defaultValue: "Select agent...",
|
|
61
|
-
}) })] }), _jsx(SelectContent, { children: initialCharacters.map((char) => char.id ? (_jsx(SelectItem, { value: char.id, children: char.name }, char.id)) : null) })] })), !selectedCharacterId && initialCharacters.length > 0 && (_jsxs(Alert, { children: [_jsx(InfoIcon, { className: "h-4 w-4" }), _jsx(AlertDescription, { children: t("cloud.documents.pleaseSelectAgent", {
|
|
62
|
-
defaultValue: "Please select an agent to manage its files.",
|
|
63
|
-
}) })] }))] }), _jsxs(Tabs, { id: "documents-tabs", value: activeTab, onValueChange: (v) => setActiveTab(v), className: "w-full", children: [isMounted && (_jsx("div", { className: "block md:hidden mb-4", children: _jsxs(Select, { value: activeTab, onValueChange: (v) => setActiveTab(v), children: [_jsx(SelectTrigger, { className: "w-full", children: _jsx(SelectValue, { children: _jsxs("div", { className: "flex items-center gap-2", children: [activeTab === "documents" && (_jsxs(_Fragment, { children: [_jsx(List, { className: "h-4 w-4" }), _jsx("span", { children: t("cloud.documents.tab.documents", {
|
|
64
|
-
defaultValue: "Documents",
|
|
65
|
-
}) })] })), activeTab === "upload" && (_jsxs(_Fragment, { children: [_jsx(Upload, { className: "h-4 w-4" }), _jsx("span", { children: t("cloud.documents.tab.upload", {
|
|
66
|
-
defaultValue: "Upload",
|
|
67
|
-
}) })] })), activeTab === "query" && (_jsxs(_Fragment, { children: [_jsx(Search, { className: "h-4 w-4" }), _jsx("span", { children: t("cloud.documents.tab.query", {
|
|
68
|
-
defaultValue: "Query",
|
|
69
|
-
}) })] }))] }) }) }), _jsxs(SelectContent, { children: [_jsx(SelectItem, { value: "documents", children: _jsxs("div", { className: "flex items-center gap-2", children: [_jsx(List, { className: "h-4 w-4" }), t("cloud.documents.tab.documents", {
|
|
70
|
-
defaultValue: "Documents",
|
|
71
|
-
})] }) }), _jsx(SelectItem, { value: "upload", children: _jsxs("div", { className: "flex items-center gap-2", children: [_jsx(Upload, { className: "h-4 w-4" }), t("cloud.documents.tab.upload", {
|
|
72
|
-
defaultValue: "Upload",
|
|
73
|
-
})] }) }), _jsx(SelectItem, { value: "query", children: _jsxs("div", { className: "flex items-center gap-2", children: [_jsx(Search, { className: "h-4 w-4" }), t("cloud.documents.tab.query", { defaultValue: "Query" })] }) })] })] }) })), _jsxs(TabsList, { className: "hidden md:grid w-full grid-cols-3", children: [_jsxs(TabsTrigger, { value: "documents", children: [_jsx(List, { className: "h-4 w-4 mr-2" }), t("cloud.documents.tab.documents", { defaultValue: "Documents" })] }), _jsxs(TabsTrigger, { value: "upload", children: [_jsx(Upload, { className: "h-4 w-4 mr-2" }), t("cloud.documents.tab.upload", { defaultValue: "Upload" })] }), _jsxs(TabsTrigger, { value: "query", children: [_jsx(Search, { className: "h-4 w-4 mr-2" }), t("cloud.documents.tab.query", { defaultValue: "Query" })] })] }), _jsx(TabsContent, { value: "documents", className: "space-y-4", children: _jsxs(Card, { children: [_jsx(CardHeader, { children: _jsx(CardTitle, { children: t("cloud.documents.uploadedFiles", {
|
|
74
|
-
defaultValue: "Uploaded Files",
|
|
75
|
-
}) }) }), _jsx(CardContent, { children: listError ? (_jsx(Alert, { variant: "destructive", children: _jsx(AlertDescription, { children: listError }) })) : (_jsx(DocumentList, { documents: documents, loading: loading, onDelete: handleDelete, onRefresh: () => void documentsQuery.refetch() })) })] }) }), _jsx(TabsContent, { value: "upload", className: "space-y-4", children: _jsxs(Card, { children: [_jsx(CardHeader, { children: _jsx(CardTitle, { children: t("cloud.documents.uploadDocuments", {
|
|
76
|
-
defaultValue: "Upload Documents",
|
|
77
|
-
}) }) }), _jsx(CardContent, { children: _jsx(DocumentUpload, { onUploadSuccess: () => void documentsQuery.refetch(), characterId: selectedCharacterId }) })] }) }), _jsx(TabsContent, { value: "query", className: "space-y-4", children: _jsxs(Card, { children: [_jsx(CardHeader, { children: _jsx(CardTitle, { children: t("cloud.documents.searchFiles", {
|
|
78
|
-
defaultValue: "Search Files",
|
|
79
|
-
}) }) }), _jsx(CardContent, { children: _jsx(DocumentQuery, { characterId: selectedCharacterId }) })] }) })] })] }));
|
|
80
|
-
}
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Documents (Knowledge) cloud domain — barrel + route/section registration.
|
|
3
|
-
*
|
|
4
|
-
* Lifted from `@elizaos/cloud-frontend/src/dashboard/documents/*` and its data
|
|
5
|
-
* hook (`src/lib/data/agents.ts`). Documents is a per-character knowledge
|
|
6
|
-
* surface (list / upload-file / upload-text / delete / semantic-query against
|
|
7
|
-
* `/api/v1/documents`, characterId-scoped); the canonical home is an
|
|
8
|
-
* agent-scoped view (PLAN §"`dashboard/documents` → AGENT-VIEW (Knowledge)").
|
|
9
|
-
*
|
|
10
|
-
* - {@link DocumentsSection} is the zero-prop component Wave 3 hands to
|
|
11
|
-
* `registerSettingsSection({ id: "documents", Component: DocumentsSection })`
|
|
12
|
-
* or mounts as a standalone view.
|
|
13
|
-
* - {@link documentsCloudRoute} is registered **at import time** at
|
|
14
|
-
* `dashboard/documents`. Unlike `dashboard/api-keys`, this path has no
|
|
15
|
-
* `CloudRouterShell` redirect to shadow, so eager registration is safe and
|
|
16
|
-
* keeps the standalone deep link live. {@link registerDocumentsCloudRoute}
|
|
17
|
-
* is also exported for re-registration at a custom path if needed.
|
|
18
|
-
*/
|
|
19
|
-
import { type CloudRouteDef } from "../shell/cloud-route-registry.js";
|
|
20
|
-
export type { DocumentsPageCharacter } from "./components/documents-page-client.js";
|
|
21
|
-
export { DocumentsPageClient } from "./components/documents-page-client.js";
|
|
22
|
-
export { DocumentsSurface, default as DocumentsRoute } from "./DocumentsRoute.js";
|
|
23
|
-
export { DocumentsSection } from "./DocumentsSection.js";
|
|
24
|
-
export { type MyAgentCharacter, useMyAgents } from "./lib/agents.js";
|
|
25
|
-
export { type CloudDocument, type QueryResult, useDeleteDocument, useDocuments, useQueryDocuments, useUploadFiles, useUploadText, } from "./lib/documents.js";
|
|
26
|
-
/** Stable view/section id + URL path slug for the Documents surface. */
|
|
27
|
-
export declare const DOCUMENTS_SECTION_ID = "documents";
|
|
28
|
-
export declare const DOCUMENTS_ROUTE_PATH = "dashboard/documents";
|
|
29
|
-
/** Cloud-route definition for the standalone Documents (Knowledge) surface. */
|
|
30
|
-
export declare const documentsCloudRoute: CloudRouteDef;
|
|
31
|
-
/**
|
|
32
|
-
* Register (or re-register) the standalone Documents route. Exported for an
|
|
33
|
-
* explicit custom-path mount; the default registration below runs at import
|
|
34
|
-
* time since `dashboard/documents` has no shell redirect to collide with.
|
|
35
|
-
*/
|
|
36
|
-
export declare function registerDocumentsCloudRoute(override?: Partial<CloudRouteDef>): void;
|
|
37
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/cloud/documents/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAGH,OAAO,EACL,KAAK,aAAa,EAEnB,MAAM,+BAA+B,CAAC;AAEvC,YAAY,EAAE,sBAAsB,EAAE,MAAM,oCAAoC,CAAC;AACjF,OAAO,EAAE,mBAAmB,EAAE,MAAM,oCAAoC,CAAC;AACzE,OAAO,EAAE,gBAAgB,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAC/E,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,KAAK,gBAAgB,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAClE,OAAO,EACL,KAAK,aAAa,EAClB,KAAK,WAAW,EAChB,iBAAiB,EACjB,YAAY,EACZ,iBAAiB,EACjB,cAAc,EACd,aAAa,GACd,MAAM,iBAAiB,CAAC;AAEzB,wEAAwE;AACxE,eAAO,MAAM,oBAAoB,cAAc,CAAC;AAChD,eAAO,MAAM,oBAAoB,wBAAwB,CAAC;AAK1D,+EAA+E;AAC/E,eAAO,MAAM,mBAAmB,EAAE,aAIjC,CAAC;AAEF;;;;GAIG;AACH,wBAAgB,2BAA2B,CACzC,QAAQ,CAAC,EAAE,OAAO,CAAC,aAAa,CAAC,GAChC,IAAI,CAEN"}
|