diff --git a/ui/admin/app/components/knowledge/AgentKnowledgePanel.tsx b/ui/admin/app/components/knowledge/AgentKnowledgePanel.tsx index c874d51ea..2bae0ca1c 100644 --- a/ui/admin/app/components/knowledge/AgentKnowledgePanel.tsx +++ b/ui/admin/app/components/knowledge/AgentKnowledgePanel.tsx @@ -133,7 +133,6 @@ export function AgentKnowledgePanel({ agentId }: { agentId: string }) { ); const onClickNotion = async () => { - // For notion, we need to ensure the remote knowledge source is created so that client can fetch a list of pages if (!notionSource) { await KnowledgeService.createRemoteKnowledgeSource(agentId, { sourceType: "notion", @@ -159,18 +158,6 @@ export function AgentKnowledgePanel({ agentId }: { agentId: string }) { await KnowledgeService.createRemoteKnowledgeSource(agentId, { sourceType: "onedrive", }); - const intervalId = setInterval(() => { - getRemoteKnowledgeSources.mutate(); - onedriveSource = remoteKnowledgeSources.find( - (source) => source.sourceType === "onedrive" - ); - if (onedriveSource?.runID) { - clearInterval(intervalId); - } - }, 1000); - setTimeout(() => { - clearInterval(intervalId); - }, 10000); } setIsOnedriveModalOpen(true); }; diff --git a/ui/admin/app/components/knowledge/FileItem.tsx b/ui/admin/app/components/knowledge/FileItem.tsx index f8aad5845..ca98d843c 100644 --- a/ui/admin/app/components/knowledge/FileItem.tsx +++ b/ui/admin/app/components/knowledge/FileItem.tsx @@ -1,4 +1,4 @@ -import { FileIcon, PlusIcon, XIcon } from "lucide-react"; +import { FileIcon, PlusIcon, TrashIcon } from "lucide-react"; import { useState } from "react"; import { KnowledgeFile } from "~/lib/model/knowledge"; @@ -101,7 +101,7 @@ function FileItem({ {actionIcon ? ( actionIcon ) : ( - + )} ) diff --git a/ui/admin/app/components/knowledge/file/FileModal.tsx b/ui/admin/app/components/knowledge/file/FileModal.tsx index 99ad97a17..bffc71a47 100644 --- a/ui/admin/app/components/knowledge/file/FileModal.tsx +++ b/ui/admin/app/components/knowledge/file/FileModal.tsx @@ -16,6 +16,12 @@ import { } from "~/components/ui/dialog"; import { Input } from "~/components/ui/input"; import { ScrollArea } from "~/components/ui/scroll-area"; +import { + Tooltip, + TooltipContent, + TooltipProvider, + TooltipTrigger, +} from "~/components/ui/tooltip"; import { useAsync } from "~/hooks/useAsync"; import { useMultiAsync } from "~/hooks/useMultiAsync"; @@ -115,14 +121,24 @@ function FileModal({ > Manage Files - + + + + + + Upload + +
diff --git a/ui/admin/app/components/knowledge/notion/NotionModal.tsx b/ui/admin/app/components/knowledge/notion/NotionModal.tsx index 662a60dd8..17d81d3fd 100644 --- a/ui/admin/app/components/knowledge/notion/NotionModal.tsx +++ b/ui/admin/app/components/knowledge/notion/NotionModal.tsx @@ -22,6 +22,12 @@ import { DialogTitle, } from "~/components/ui/dialog"; import { ScrollArea } from "~/components/ui/scroll-area"; +import { + Tooltip, + TooltipContent, + TooltipProvider, + TooltipTrigger, +} from "~/components/ui/tooltip"; import IngestionStatusComponent from "../IngestionStatus"; @@ -60,6 +66,8 @@ export const NotionModal: FC = ({ startPolling(); }; + const hasKnowledgeFiles = knowledgeFiles.length > 0; + return ( = ({ Notion
-
- - +
+ + + + + + Refresh + + + + + + Settings + +
diff --git a/ui/admin/app/components/knowledge/onedrive/OneDriveModal.tsx b/ui/admin/app/components/knowledge/onedrive/OneDriveModal.tsx index 9f45b2733..894f499a9 100644 --- a/ui/admin/app/components/knowledge/onedrive/OneDriveModal.tsx +++ b/ui/admin/app/components/knowledge/onedrive/OneDriveModal.tsx @@ -24,6 +24,12 @@ import { Avatar } from "~/components/ui/avatar"; import { Button } from "~/components/ui/button"; import { Dialog, DialogContent, DialogTitle } from "~/components/ui/dialog"; import { ScrollArea } from "~/components/ui/scroll-area"; +import { + Tooltip, + TooltipContent, + TooltipProvider, + TooltipTrigger, +} from "~/components/ui/tooltip"; import IngestionStatusComponent from "../IngestionStatus"; import RemoteFileItemChip from "../RemoteFileItemChip"; @@ -95,6 +101,7 @@ export const OnedriveModal: FC = ({ startPolling(); }; + const hasKnowledgeFiles = knowledgeFiles.length > 0; return ( = ({ OneDrive
- - - + + + + + + Add + + + + + + Refresh + + + + + + Settings + +
{links.map((link, index) => (
- {/* eslint-disable-next-line */} -
{ if ( showTable[index] === undefined || @@ -222,12 +256,11 @@ export const OnedriveModal: FC = ({ ) : ( ))} -
+ {showTable[index] && (
{knowledgeFiles - .filter((item) => onedriveSource?.state?.onedriveState?.files?.[ item.uploadID! @@ -274,19 +307,22 @@ export const OnedriveModal: FC = ({ ))}
{knowledgeFiles - .filter( - (item) => - !links.some( - (link) => - onedriveSource?.state?.onedriveState?.files?.[ - item.uploadID! - ]?.folderPath?.startsWith( - onedriveSource?.state - ?.onedriveState - ?.links?.[link]?.name ?? - "" - ) ?? false - ) + .filter((item) => + links.every((link) => { + // If we have file state and find out that file doesn't belong to any link, then we should it as separate files as this link is pointing to a file + const fileState = + onedriveSource?.state?.onedriveState + ?.files?.[item.uploadID!]; + return ( + fileState && + !fileState?.folderPath?.startsWith( + onedriveSource?.state + ?.onedriveState?.links?.[ + link + ]?.name ?? "" + ) + ); + }) ) .map((item) => ( = ({ {knowledgeFiles?.some((item) => item.approved) && ( )} - {onedriveSource?.runID && ( - - )} + {onedriveSource?.state?.onedriveState?.links && + onedriveSource?.runID && ( + + )}
- - - + + + + + + Add + + + + + + Refresh + + + + + + Settings + +
@@ -246,7 +281,7 @@ export const WebsiteModal: FC = ({ handleApproveAll(); setLoading(false); }} - disabled={loading} + disabled={loading || !hasKnowledgeFiles} > {loading ? (